Skip to content

A platform for community discussion. Free, open, simple.

FIX: typing into a focused header-filter select-kit (#45148)

Régis Hanolca1fc95945fd
diff --git a/frontend/discourse/select-kit/components/select-kit/select-kit-header.js b/frontend/discourse/select-kit/components/select-kit/select-kit-header.js
index 5b0a17ecc4e..039459f51ad 100644
--- a/frontend/discourse/select-kit/components/select-kit/select-kit-header.js
+++ b/frontend/discourse/select-kit/components/select-kit/select-kit-header.js
@@ -100,7 +100,7 @@ export default class SelectKitHeader extends Component {
if (
this.selectKit.isDisabled ||
this.selectKit.options.disabled ||
- this.selectKit.options.useHeaderFilter
+ (this.selectKit.options.useHeaderFilter && event.target !== this.element)
) {
return;
}
diff --git a/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs b/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
index 914b38dff0f..1f728b634bf 100644
--- a/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.gjs
@@ -340,7 +340,12 @@ module(
assert.dom(".select-kit-header button[data-name='potato']").exists();
const filterInput = ".select-kit-header .filter-input";
- await click(filterInput);
+ await triggerKeyEvent(".select-kit-header", "keydown", 77);
+
+ assert.dom(filterInput).isFocused();
+ assert.dom(filterInput).hasValue("m");
+
+ await this.subject.emptyFilter();
await triggerKeyEvent(filterInput, "keydown", "ArrowDown");
await triggerKeyEvent(filterInput, "keydown", "Enter");