Skip to content

Commit 5fdc7a0

Browse files
committed
fix(a11y): adds Dialog.Description and idiomatic test query
1 parent cd80c51 commit 5fdc7a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/app/components/shared/NotificationDrawer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default function NotificationDrawer(props: NotificationDrawerProps) {
2929
<Dialog.Portal>
3030
<Dialog.Overlay class="drawer-overlay fixed inset-0 bg-black/50 z-[70]" data-testid="notification-overlay" />
3131
<Dialog.Content class="drawer-content fixed top-0 right-0 h-full w-80 sm:w-96 bg-base-100 shadow-xl z-[71] flex flex-col">
32+
<Dialog.Description class="sr-only">Recent system notifications and errors</Dialog.Description>
3233
{/* Header */}
3334
<div class="flex items-center gap-2 px-4 py-3 border-b border-base-300 shrink-0">
3435
<Dialog.Title class="text-lg font-semibold text-base-content flex-1">

tests/components/shared/NotificationDrawer.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ describe("NotificationDrawer", () => {
111111
const onClose = vi.fn();
112112
render(() => <NotificationDrawer open={true} onClose={onClose} />);
113113
vi.advanceTimersByTime(0);
114-
const overlay = document.body.querySelector("[data-testid='notification-overlay']") as HTMLElement;
115-
expect(overlay).not.toBeNull();
114+
const overlay = screen.getByTestId("notification-overlay");
116115
fireEvent.pointerDown(overlay);
117116
expect(onClose).toHaveBeenCalled();
118117
});

0 commit comments

Comments
 (0)