Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
gifs: Use an `x` button to clear search input.
apoorvapendse666be2ad53d8
diff --git a/web/src/giphy.ts b/web/src/giphy.tsindex a0eb078c955..5c2a2c47cee 100644--- a/web/src/giphy.ts+++ b/web/src/giphy.ts@@ -170,6 +170,11 @@ function toggle_giphy_popover(target: HTMLElement): void {$popper.on("keydown", ".giphy-gif", ui_util.convert_enter_to_click);$popper.on("keydown", ".compose-gif-icon-giphy", ui_util.convert_enter_to_click);+ $popper.on("click", "#gif-search-clear", (e) => {+ e.stopPropagation();+ $("#gif-search-query").val("");+ void update_grid_with_search_term();+ });void (async () => {gifs_grid = await renderGIPHYGrid(the($popper.find(".giphy-content")));diff --git a/web/src/tenor.ts b/web/src/tenor.tsindex d185352876a..4bd2f80a213 100644--- a/web/src/tenor.ts+++ b/web/src/tenor.ts@@ -214,7 +214,11 @@ function toggle_tenor_popover(target: HTMLElement): void {assert(e.currentTarget instanceof HTMLElement);handle_gif_click(e.currentTarget);});-+ $popper.on("click", "#gif-search-clear", (e) => {+ e.stopPropagation();+ $("#gif-search-query").val("");+ update_grid_with_search_term("");+ });$popper.on("keydown", ".tenor-gif", (e) => {assert(e.currentTarget instanceof HTMLElement);const key = e.key;diff --git a/web/styles/popovers.css b/web/styles/popovers.cssindex 0958e875ef1..4d95c611a0e 100644--- a/web/styles/popovers.css+++ b/web/styles/popovers.css@@ -711,6 +711,30 @@ ul.popover-group-menu-member-list {border: 0;padding: 0;+ .popover-filter-input-wrapper {+ position: relative;+ }++ .clear-search-button {+ position: absolute;+ /* The 60% instead of the usual 50% makes this+ `x` button appear vertically centered inside the+ input instead of the wrapper. */+ top: 60%;+ transform: translateY(-50%);+ right: 0.5em;+ font-size: 1em;+ outline: none;+ background: none;+ border: none;+ padding: 0;+ opacity: 0.5;++ &:hover {+ opacity: 1;+ }+ }+.tenor-content {display: grid;grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));diff --git a/web/templates/gif_picker_ui.hbs b/web/templates/gif_picker_ui.hbsindex 1fec440f1d4..207f316e420 100644--- a/web/templates/gif_picker_ui.hbs+++ b/web/templates/gif_picker_ui.hbs@@ -7,6 +7,9 @@{{else}}<input type="text" id="gif-search-query" class="popover-filter-input filter_text_input" autocomplete="off" placeholder="{{t 'Search Tenor' }}" autofocus/>{{/if}}+ <button type="button" class="clear-search-button" id="gif-search-clear" tabindex="-1">+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>+ </button></div><div class="gif-scrolling-container" data-simplebar data-simplebar-tab-index="-1">{{! We need a container we can replace