Skip to content

Commit

Permalink
fix(Notification): remove tabindex on close buttons (#17852)
Browse files Browse the repository at this point in the history
* fix(Notification): remove tabindex on close button

* chore: update snapshots

* fix(Notification): remove aria-hidden on close buttons

* chore: update snapshots
  • Loading branch information
emyarod authored Oct 25, 2024
1 parent d73bd2c commit 0810fa1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
4 changes: 0 additions & 4 deletions packages/react/src/components/Notification/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,7 @@ export function ToastNotification({
<NotificationButton
notificationType="toast"
onClick={handleCloseButtonClick}
aria-hidden="true"
aria-label={deprecatedAriaLabel || ariaLabel}
tabIndex={-1}
/>
)}
</div>
Expand Down Expand Up @@ -739,9 +737,7 @@ export function InlineNotification({
<NotificationButton
notificationType="inline"
onClick={handleCloseButtonClick}
aria-hidden="true"
aria-label={ariaLabel}
tabIndex={-1}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,6 @@ describe('ToastNotification', () => {
spy.mockRestore();
});

it('close button is rendered by default and includes aria-hidden=true', () => {
render(<ToastNotification title="Notification title" />);

const closeButton = screen.queryByRole('button', {
hidden: true,
});

expect(closeButton).toBeInTheDocument();
expect(closeButton).toHaveAttribute('aria-hidden', 'true');
});

it('does not render close button when `hideCloseButton` is provided', () => {
render(<ToastNotification title="Notification title" hideCloseButton />);
const closeButton = screen.queryByRole('button', {
Expand Down Expand Up @@ -255,16 +244,6 @@ describe('InlineNotification', () => {
spy.mockRestore();
});

it('close button is rendered by default and includes aria-hidden=true', () => {
render(<InlineNotification title="Notification title" />);

const closeButton = screen.queryByRole('button', {
hidden: true,
});
expect(closeButton).toBeInTheDocument();
expect(closeButton).toHaveAttribute('aria-hidden', 'true');
});

it('does not render close button when `hideCloseButton` is provided', () => {
render(<InlineNotification title="Notification title" hideCloseButton />);
const closeButton = screen.queryByRole('button', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ exports[`InlineNotification should render 1`] = `
</div>
</div>
<button
aria-hidden="true"
aria-label="close notification"
class="cds--inline-notification__close-button"
tabindex="-1"
title="close notification"
type="button"
>
Expand Down Expand Up @@ -202,10 +200,8 @@ exports[`ToastNotification should render 1`] = `
</div>
</div>
<button
aria-hidden="true"
aria-label="close notification"
class="cds--toast-notification__close-button"
tabindex="-1"
title="close notification"
type="button"
>
Expand Down

0 comments on commit 0810fa1

Please sign in to comment.