mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-10-31 03:52:13 +08:00
Focus on popover first then element
This commit is contained in:
+1
-1
@@ -28,8 +28,8 @@ function trapFocus(e: KeyboardEvent) {
|
||||
const popoverEl = getState("popover")?.wrapper;
|
||||
|
||||
const focusableEls = getFocusableElements([
|
||||
...(activeElement ? [activeElement] : []),
|
||||
...(popoverEl ? [popoverEl] : []),
|
||||
...(activeElement ? [activeElement] : []),
|
||||
]);
|
||||
|
||||
const firstFocusableEl = focusableEls[0];
|
||||
|
||||
+1
-1
@@ -224,7 +224,7 @@ export function renderPopover(element: Element, step: DriveStep) {
|
||||
|
||||
// Focus on the first focusable element in active element or popover
|
||||
const isToDummyElement = element.classList.contains("driver-dummy-element");
|
||||
const focusableElement = getFocusableElements([...(isToDummyElement ? [] : [element]), popoverWrapper]);
|
||||
const focusableElement = getFocusableElements([popoverWrapper, ...(isToDummyElement ? [] : [element])]);
|
||||
if (focusableElement.length > 0) {
|
||||
focusableElement[0].focus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user