fix(combobox): open on focused when showAllOnEmpty
This commit is contained in:
parent
72a6ccc81e
commit
b7743d8f22
3 changed files with 21 additions and 1 deletions
|
|
@ -8,4 +8,5 @@ Allow Subclassers of LionCombobox to set '\_syncToTextboxCondition' in closing p
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
Allow an extra microtask in registration phase to make forms inside dialogs compatible.
|
- form-core: allow an extra microtask in registration phase to make forms inside dialogs compatible.
|
||||||
|
- combobox: open on focused when showAllOnEmpty
|
||||||
|
|
|
||||||
|
|
@ -390,6 +390,9 @@ export class LionCombobox extends OverlayMixin(LionListbox) {
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line class-methods-use-this
|
// eslint-disable-next-line class-methods-use-this
|
||||||
_showOverlayCondition({ lastKey }) {
|
_showOverlayCondition({ lastKey }) {
|
||||||
|
if (this.showAllOnEmpty && this.focused) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// when no keyboard action involved (on focused change), return current opened state
|
// when no keyboard action involved (on focused change), return current opened state
|
||||||
if (!lastKey) {
|
if (!lastKey) {
|
||||||
return this.opened;
|
return this.opened;
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,22 @@ describe('lion-combobox', () => {
|
||||||
el.autocomplete = 'both';
|
el.autocomplete = 'both';
|
||||||
await performChecks();
|
await performChecks();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('shows overlay on focusin', async () => {
|
||||||
|
const el = /** @type {LionCombobox} */ (await fixture(html`
|
||||||
|
<lion-combobox name="foo" .showAllOnEmpty="${true}">
|
||||||
|
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
||||||
|
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
||||||
|
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
||||||
|
<lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
|
||||||
|
</lion-combobox>
|
||||||
|
`));
|
||||||
|
|
||||||
|
expect(el.opened).to.be.false;
|
||||||
|
el._comboboxNode.dispatchEvent(new Event('focusin', { bubbles: true, composed: true }));
|
||||||
|
await el.updateComplete;
|
||||||
|
expect(el.opened).to.be.true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue