mirror of https://github.com/Fabio286/antares.git
fix: error on modals missing focusable elements
This commit is contained in:
parent
e97da37103
commit
7702ca025f
|
@ -60,11 +60,14 @@ const useFocusTrap = (args?: {disableAutofocus?: boolean}) => {
|
||||||
focusableElements = (trapRef.value as HTMLElement).querySelectorAll(
|
focusableElements = (trapRef.value as HTMLElement).querySelectorAll(
|
||||||
focusableElementsSelector
|
focusableElementsSelector
|
||||||
);
|
);
|
||||||
$firstFocusable = focusableElements[0];
|
|
||||||
$lastFocusable = focusableElements[focusableElements.length - 1];
|
if (focusableElements.length) {
|
||||||
document.addEventListener('keydown', keyHandler);
|
$firstFocusable = focusableElements[0];
|
||||||
isInitiated.value = true;
|
$lastFocusable = focusableElements[focusableElements.length - 1];
|
||||||
if (!localArgs.disableAutofocus) $firstFocusable.focus();
|
document.addEventListener('keydown', keyHandler);
|
||||||
|
isInitiated.value = true;
|
||||||
|
if (!localArgs.disableAutofocus) $firstFocusable.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearFocusTrap () {
|
function clearFocusTrap () {
|
||||||
|
|
Loading…
Reference in New Issue