fix: Fix bug that preventing scrolling menu items into view. (#8726)

* fix: Fix bug that preventing scrolling menu items into view.

* chore: Deprecate now-unused-in-core functions in style.
This commit is contained in:
Aaron Dodson
2025-01-10 10:38:30 -08:00
committed by GitHub
parent a42c2d1508
commit 0c20129a26
3 changed files with 19 additions and 10 deletions

View File

@@ -260,10 +260,11 @@ export class Menu {
this.highlightedItem = item;
// Bring the highlighted item into view. This has no effect if the menu is
// not scrollable.
const el = this.getElement() as Element;
style.scrollIntoContainerView(item.getElement() as Element, el);
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
const el = this.getElement();
if (el) {
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
}
item.getElement()?.scrollIntoView();
}
}