Skip to content

Commit

Permalink
fix: update observer to also include input container
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Dec 27, 2024
1 parent 17dd983 commit 982592b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/select/src/vaadin-select-base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const SelectBaseMixin = (superClass) =>
return [
'_updateAriaExpanded(opened, focusElement)',
'_updateSelectedItem(value, _items, placeholder)',
'_openedChanged(opened, _overlayElement)',
'_openedChanged(opened, _overlayElement, _inputContainer)',
];
}

Expand All @@ -186,7 +186,6 @@ export const SelectBaseMixin = (superClass) =>
super.ready();

this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
this._overlayElement = this.$.overlay;

this._valueButtonController = new ButtonController(this);
this.addController(this._valueButtonController);
Expand Down Expand Up @@ -362,8 +361,8 @@ export const SelectBaseMixin = (superClass) =>
}

/** @private */
_openedChanged(opened, overlayElement) {
if (!overlayElement) {
_openedChanged(opened, overlayElement, inputContainer) {
if (!overlayElement || !inputContainer) {
return;
}

Expand All @@ -377,7 +376,7 @@ export const SelectBaseMixin = (superClass) =>
// Avoid multiple announcements when a value gets selected from the dropdown
this._updateAriaLive(false);

overlayElement.style.setProperty('--vaadin-select-text-field-width', `${this._inputContainer.offsetWidth}px`);
overlayElement.style.setProperty('--vaadin-select-text-field-width', `${inputContainer.offsetWidth}px`);

// Preserve focus-ring to restore it later
const hasFocusRing = this.hasAttribute('focus-ring');
Expand Down

0 comments on commit 982592b

Please sign in to comment.