UX: ensures user-status-picker’s input is autofocused (#23083)

I tried using "autofocus=true" first but it was not reliable in tests.
This commit is contained in:
Joffrey JAFFEUX 2023-08-14 17:19:44 +02:00 committed by GitHub
parent 04c9c81cda
commit ea6a89397a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,8 @@ export default class UserStatusPicker extends Component {
if (!this.status) {
this.set("status", {});
}
document.querySelector(".user-status-description")?.focus();
}
@computed("status.emoji")

View File

@ -26,6 +26,12 @@ module("Integration | Component | user-status-picker", function (hooks) {
);
});
test("it focuses the input on insert", async function (assert) {
await render(hbs`<UserStatusPicker />`);
assert.dom(".user-status-description").isFocused();
});
test("it picks emoji", async function (assert) {
const status = {
emoji: "tooth",