mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat(modal): exclude close button from focus trap in modal
This commit is contained in:
@@ -66,9 +66,9 @@ const Modal: FunctionComponent<ComponentProps> = (
|
||||
useEffect(() => {
|
||||
const modal: HTMLDivElement | null = modalRef.current;
|
||||
if (modal) {
|
||||
// Focus the first focusable element in the modal
|
||||
// Focus the first focusable element in the modal, excluding the close button
|
||||
const focusableElements: NodeListOf<Element> = modal.querySelectorAll(
|
||||
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',
|
||||
'button:not([data-testid="close-button"]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',
|
||||
);
|
||||
const firstFocusable: HTMLElement | undefined = focusableElements[0] as
|
||||
| HTMLElement
|
||||
|
||||
Reference in New Issue
Block a user