search: Refactor how close buttons are handled.

We refactor the following inputs to use a `placeholder-shown` CSS selector to
show/hide the close button, rather than custom JS logic:
- Filter topics field in the left sidebar
- Filter direct messages field under direct messages
- Stream message topic
This commit is contained in:
opmkumar
2024-09-24 04:34:10 +05:30
committed by GitHub
parent 5bde07c842
commit 1ddc1d2d12
7 changed files with 13 additions and 32 deletions

View File

@@ -512,21 +512,8 @@ export function initialize() {
$("#compose_recipient_box").on("click", "#recipient_box_clear_topic_button", () => {
const $input = $("input#stream_message_recipient_topic");
const $button = $("#recipient_box_clear_topic_button");
$input.val("");
$input.trigger("focus");
$button.hide();
});
$("#compose_recipient_box").on("input", "input#stream_message_recipient_topic", (e) => {
const $button = $("#recipient_box_clear_topic_button");
const value = $(e.target).val();
if (value.length === 0) {
$button.hide();
} else {
$button.show();
}
});
$("input#stream_message_recipient_topic").on("focus", () => {