From a52e954aa935ddee61a0e50d2ce927df16640b2e Mon Sep 17 00:00:00 2001 From: Andrew Kirwin Date: Wed, 11 Dec 2024 22:21:48 +0000 Subject: [PATCH] add dropdown primitive ctd --- addon/components/select-box/index.gjs | 10 ---------- tests/dummy/app/styles/example.scss | 1 - tests/dummy/app/styles/example3.scss | 4 ++++ tests/dummy/app/styles/example4.scss | 4 ++++ .../components/select-box/index/focus-test.gjs | 12 ++++-------- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/addon/components/select-box/index.gjs b/addon/components/select-box/index.gjs index dea37a87..7f31ff20 100644 --- a/addon/components/select-box/index.gjs +++ b/addon/components/select-box/index.gjs @@ -274,15 +274,6 @@ export default class SelectBox extends Component { this._ensureFocus(); } - @action - handleFocusOut() { - if (this.dropdown) { - return; - } - - this._forgetActiveOption(); - } - @action handleKeyDownTrigger(event) { this._handleKeyDown(event); @@ -671,7 +662,6 @@ export default class SelectBox extends Component { data-disabled="{{this.isDisabled}}" {{on "mouseleave" this.handleMouseLeave}} {{on "mousedown" this.handleMouseDown}} - {{on "focusout" this.handleFocusOut}} {{lifecycle onInsert=this.handleInsertElement onDestroy=this.handleDestroyElement diff --git a/tests/dummy/app/styles/example.scss b/tests/dummy/app/styles/example.scss index 772bac8f..666840b4 100644 --- a/tests/dummy/app/styles/example.scss +++ b/tests/dummy/app/styles/example.scss @@ -31,7 +31,6 @@ @mixin dropdown-content { display: flex; flex-direction: column; - overflow: auto; } @mixin options { diff --git a/tests/dummy/app/styles/example3.scss b/tests/dummy/app/styles/example3.scss index 108723eb..4de60468 100644 --- a/tests/dummy/app/styles/example3.scss +++ b/tests/dummy/app/styles/example3.scss @@ -27,6 +27,10 @@ height: 240px; } + .select-box__options { + @include example.options; + } + .select-box__option { @include example.option; } diff --git a/tests/dummy/app/styles/example4.scss b/tests/dummy/app/styles/example4.scss index 070e92ac..6300f504 100644 --- a/tests/dummy/app/styles/example4.scss +++ b/tests/dummy/app/styles/example4.scss @@ -27,6 +27,10 @@ height: 282px; } + .select-box__options { + @include example.options; + } + .select-box__option { @include example.option; } diff --git a/tests/integration/components/select-box/index/focus-test.gjs b/tests/integration/components/select-box/index/focus-test.gjs index 0db8a8e6..161ebd23 100644 --- a/tests/integration/components/select-box/index/focus-test.gjs +++ b/tests/integration/components/select-box/index/focus-test.gjs @@ -591,15 +591,9 @@ module('select-box (focus)', function (hooks) { ); }); - test('focus out listbox forgets active option', async function (assert) { + test('focus out does not forget active option', async function (assert) { assert.expect(2); - // We only show the active option when the select box has focus, - // because it is receptive to user input and therefore can - // be selected. When not focused, there is no need for it. - // This is the equivalent of when a select box with a dropdown - // (a combobox) is closed. - await render(