UX: ensures browse view input is focused on page load (#19137)
No test as I don't think it's worth the complexity of a test.
This commit is contained in:
parent
d127d2acdf
commit
e9863b145c
|
@ -2,6 +2,7 @@ import { INPUT_DELAY } from "discourse-common/config/environment";
|
|||
import Component from "@ember/component";
|
||||
import { action, computed } from "@ember/object";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { inject as service } from "@ember/service";
|
||||
import ChatApi from "discourse/plugins/chat/discourse/lib/chat-api";
|
||||
import discourseDebounce from "discourse-common/lib/debounce";
|
||||
|
@ -95,6 +96,11 @@ export default class ChatBrowseView extends Component {
|
|||
showModal("create-channel");
|
||||
}
|
||||
|
||||
@action
|
||||
focusFilterInput(input) {
|
||||
schedule("afterRender", () => input?.focus());
|
||||
}
|
||||
|
||||
@bind
|
||||
filterChannels(filter) {
|
||||
this.canLoadMore = true;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
@filterAction={{action "debouncedFiltering"}}
|
||||
@icons={{hash right="search"}}
|
||||
placeholder={{i18n "chat.browse.filter_input_placeholder"}}
|
||||
{{did-insert (action this.focusFilterInput)}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue