Focus on popover first then element

This commit is contained in:
Kamran Ahmed
2023-07-24 00:32:23 +01:00
parent dbd83c4057
commit c0779f1019
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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
View File
@@ -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();
}