diff options
author | Eric Bailey <git@esb.lol> | 2024-03-04 15:37:11 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 15:37:11 -0600 |
commit | 6c9d6f5b05953988cb4fb1556bf435805479e07e (patch) | |
tree | 98a19db445461f6c6007680aa0a8ede2e58634f1 /src/components/Dialog/index.web.tsx | |
parent | ebd279ed6839965af5e033ed7f430aa7401fd77d (diff) | |
download | voidsky-6c9d6f5b05953988cb4fb1556bf435805479e07e.tar.zst |
Improve dialogs a11y (#3094)
* Improve a11y on ios * Format * Remove android * Fix android
Diffstat (limited to 'src/components/Dialog/index.web.tsx')
-rw-r--r-- | src/components/Dialog/index.web.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/components/Dialog/index.web.tsx b/src/components/Dialog/index.web.tsx index 32163e735..3a7f73342 100644 --- a/src/components/Dialog/index.web.tsx +++ b/src/components/Dialog/index.web.tsx @@ -12,7 +12,7 @@ import {DialogOuterProps, DialogInnerProps} from '#/components/Dialog/types' import {Context} from '#/components/Dialog/context' import {Button, ButtonIcon} from '#/components/Button' import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times' -import {useDialogStateContext} from '#/state/dialogs' +import {useDialogStateControlContext} from '#/state/dialogs' export {useDialogControl, useDialogContext} from '#/components/Dialog/context' export * from '#/components/Dialog/types' @@ -30,21 +30,21 @@ export function Outer({ const {gtMobile} = useBreakpoints() const [isOpen, setIsOpen] = React.useState(false) const [isVisible, setIsVisible] = React.useState(true) - const {openDialogs} = useDialogStateContext() + const {setDialogIsOpen} = useDialogStateControlContext() const open = React.useCallback(() => { setIsOpen(true) - openDialogs.current.add(control.id) - }, [setIsOpen, openDialogs, control.id]) + setDialogIsOpen(control.id, true) + }, [setIsOpen, setDialogIsOpen, control.id]) const close = React.useCallback(async () => { setIsVisible(false) await new Promise(resolve => setTimeout(resolve, 150)) setIsOpen(false) setIsVisible(true) - openDialogs.current.delete(control.id) + setDialogIsOpen(control.id, false) onClose?.() - }, [onClose, setIsOpen, openDialogs, control.id]) + }, [onClose, setIsOpen, setDialogIsOpen, control.id]) useImperativeHandle( control.ref, |