diff --git a/packages/components/src/components/dropdown-select/dropdown-select.tsx b/packages/components/src/components/dropdown-select/dropdown-select.tsx index 7325431046..afe80c06ce 100644 --- a/packages/components/src/components/dropdown-select/dropdown-select.tsx +++ b/packages/components/src/components/dropdown-select/dropdown-select.tsx @@ -270,7 +270,7 @@ export class DropdownSelect { @State() hasFocus: boolean = false; private comboEl: HTMLElement; - private listboxEl: HTMLElement; + private scrollContainer: HTMLElement; private listboxPadEl: HTMLElement; private hiddenInput: HTMLInputElement; @@ -346,10 +346,10 @@ export class DropdownSelect { bringIntoView(index) { const options: NodeListOf = - this.listboxEl.querySelectorAll('[role=option]'); + this.scrollContainer.querySelectorAll('[role=option]'); - if (hasOverflow(this.listboxEl)) { - keepInView(options[index], this.listboxEl); + if (hasOverflow(this.scrollContainer)) { + keepInView(options[index], this.scrollContainer); } if (!isInView(options[index])) { @@ -530,13 +530,13 @@ export class DropdownSelect {
(this.listboxPadEl = el)}>
(this.scrollContainer = el)} part="listbox-scroll-container" onMouseDown={(e) => { e.preventDefault(); }} >
(this.listboxEl = el)} part="listbox" role="listbox" id={`${this.comboboxId}-listbox`}