Skip to content

Commit

Permalink
feat(Modal): added ariaHidden to Modal component Props. (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
yosipy authored Aug 27, 2024
1 parent 9f583d2 commit 45fa820
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ export type ModalProps = React.HTMLAttributes<HTMLDialogElement> &
open?: boolean
responsive?: boolean
backdrop?: boolean
ariaHidden?: boolean
}

const Modal = forwardRef<HTMLDialogElement, ModalProps>(
(
{ children, open, responsive, backdrop, dataTheme, className, ...props },
{
children,
open,
responsive,
backdrop,
ariaHidden,
dataTheme,
className,
...props
},
ref
): JSX.Element => {
const containerClasses = twMerge(
Expand All @@ -29,13 +39,14 @@ const Modal = forwardRef<HTMLDialogElement, ModalProps>(
})
)

ariaHidden = ariaHidden ?? !open
const bodyClasses = twMerge('modal-box', className)

return (
<dialog
{...props}
aria-label="Modal"
aria-hidden={!open}
aria-hidden={ariaHidden}
open={open}
aria-modal={open}
data-theme={dataTheme}
Expand Down

0 comments on commit 45fa820

Please sign in to comment.