fix: Fix bug that prevented keyboard navigation in flyouts. (#8687)

* fix: Fix bug that prevented keyboard navigation in flyouts.

* refactor: Add an `isFocusable()` method to FlyoutItem.
This commit is contained in:
Aaron Dodson
2025-01-09 14:31:51 -08:00
committed by GitHub
parent 80a6d85c26
commit 75efba92e3
12 changed files with 203 additions and 81 deletions

View File

@@ -13,7 +13,8 @@
import * as browserEvents from './browser_events.js';
import * as dropDownDiv from './dropdowndiv.js';
import {Flyout, FlyoutItem} from './flyout_base.js';
import {Flyout} from './flyout_base.js';
import type {FlyoutItem} from './flyout_item.js';
import type {Options} from './options.js';
import * as registry from './registry.js';
import {Scrollbar} from './scrollbar.js';
@@ -263,10 +264,10 @@ export class HorizontalFlyout extends Flyout {
}
for (const item of contents) {
const rect = item.element.getBoundingRectangle();
const rect = item.getElement().getBoundingRectangle();
const moveX = this.RTL ? cursorX + rect.getWidth() : cursorX;
item.element.moveBy(moveX, cursorY);
cursorX += item.element.getBoundingRectangle().getWidth();
item.getElement().moveBy(moveX, cursorY);
cursorX += item.getElement().getBoundingRectangle().getWidth();
}
}
@@ -336,7 +337,7 @@ export class HorizontalFlyout extends Flyout {
let flyoutHeight = this.getContents().reduce((maxHeightSoFar, item) => {
return Math.max(
maxHeightSoFar,
item.element.getBoundingRectangle().getHeight(),
item.getElement().getBoundingRectangle().getHeight(),
);
}, 0);
flyoutHeight += this.MARGIN * 1.5;