Skip to content

Commit

Permalink
Add accessible names to profile and notebook dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Feb 23, 2024
1 parent 3e8d9d6 commit bdcb3c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/annotator/components/ModalDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ type DialogProps = {
children: ComponentChildren;
onClose: () => void;
'data-testid'?: string;
'aria-label'?: string;
};

function NativeDialog({
closed,
onClose,
children,
'data-testid': testId,
'aria-label': label,
}: DialogProps) {
const dialogRef = useRef<HTMLDialogElement | null>(null);

Expand All @@ -39,6 +41,7 @@ function NativeDialog({
ref={dialogRef}
className="relative w-full h-full backdrop:bg-black/50"
data-testid={testId}
aria-label={label}
>
{children}
</dialog>
Expand Down
3 changes: 2 additions & 1 deletion src/annotator/components/NotebookModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ export default function NotebookModal({
closed={isHidden}
onClose={onClose}
data-testid="notebook-outer"
aria-label="Hypothesis notebook"
>
<div className="absolute right-0 m-3">
<IconButton
title="Close the Notebook"
title="Close notebook"
onClick={onClose}
variant="dark"
classes={classnames(
Expand Down
1 change: 1 addition & 0 deletions src/annotator/components/ProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function ProfileModal({ eventBus, config }: ProfileModalProps) {
closed={isHidden}
onClose={onClose}
data-testid="profile-outer"
aria-label="Hypothesis profile"
>
<div className="absolute right-0 m-3">
<IconButton
Expand Down

0 comments on commit bdcb3c2

Please sign in to comment.