Skip to content

Commit

Permalink
chore(Modal): added ariaHidden to Modal component Props. (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
yosipy authored and benjitrosch committed Aug 28, 2024
1 parent 9f583d2 commit 9e5064d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 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
2 changes: 1 addition & 1 deletion src/Range/Range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Range = forwardRef<HTMLInputElement, RangeProps>(

const calculatedDisplayTicks = displayTicks ?? (step !== undefined);
const calculatedStep = step !== undefined ? Number(step) : 1; // default value per HTML standard
const calculatedTicksStep = ticksStep ?? calculatedStep;
const calculatedTicksStep = !!ticksStep ? ticksStep : calculatedStep;
const min = props.min !== undefined ? Number(props.min) : 0; // default value per HTML standard
const max = props.max !== undefined ? Number(props.max) : 100; // default value per HTML standard

Expand Down

0 comments on commit 9e5064d

Please sign in to comment.