Show Login and Ask an organizer sent and error states.
Connect the live modals to the drawn sent, expired, invalid-email, and send-failed screens, pin the phone footer above the keyboard, and send the light login email.
This commit is contained in:
1 parent
44010c7b73
commit
27d74e510c
29 files changed
+771
-281
No files matched your search
@@ -6,6 +6,20 @@ import { useEffect, useLayoutEffect, useRef } from "react";
|
||||
const FOCUSABLE_SELECTOR =
|
||||
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
||||
|
||||
const FIELD_SELECTOR =
|
||||
'input:not([type="hidden"]):not([type="checkbox"]):not([disabled]):not([tabindex="-1"]), textarea:not([disabled]):not([tabindex="-1"])';
|
||||
|
||||
function initialFocus(dialog: HTMLElement): HTMLElement | undefined {
|
||||
const email = dialog.querySelector<HTMLElement>(
|
||||
'input[type="email"]:not([disabled]):not([tabindex="-1"])',
|
||||
);
|
||||
if (email) return email;
|
||||
const field = dialog.querySelector<HTMLElement>(FIELD_SELECTOR);
|
||||
if (field) return field;
|
||||
const focusable = dialog.querySelectorAll(FOCUSABLE_SELECTOR);
|
||||
return focusable[0] as HTMLElement | undefined;
|
||||
}
|
||||
|
||||
let lastInteractedFocusable: HTMLElement | null = null;
|
||||
let interactionTrackingBound = false;
|
||||
|
||||
@@ -118,10 +132,7 @@ export function useCreateModalA11y(
|
||||
document.body.style.overflow = "hidden";
|
||||
|
||||
if (dialogRef.current) {
|
||||
const focusableElements = dialogRef.current.querySelectorAll(
|
||||
FOCUSABLE_SELECTOR,
|
||||
);
|
||||
const firstElement = focusableElements[0] as HTMLElement | undefined;
|
||||
const firstElement = initialFocus(dialogRef.current);
|
||||
if (firstElement) {
|
||||
firstElement.focus();
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user