Skip to content

Commit

Permalink
Revert "Revert the Button's disabled state (#2340)" (#2351)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored Dec 19, 2023
1 parent dbceca6 commit cf297de
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .changeset/cold-buses-fail.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@sumup/circuit-ui': minor
'@sumup/circuit-ui': major
---

Changed the NotificationInline's action from the Button to the Anchor component. Update the action props if necessary.
2 changes: 1 addition & 1 deletion .changeset/old-schools-walk.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
'@sumup/circuit-ui': minor
'@sumup/circuit-ui': major
---

Changed the default size of the CloseButton from 40px to 48px to match the Button component.
5 changes: 5 additions & 0 deletions .changeset/orange-squids-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sumup/circuit-ui': major
---

Improved the accessibility of disabled Buttons. The `disabled` attribute has been replaced with the `aria-disabled` attribute which enables the disabled element to receive focus and be perceived by screenreader users. Interactions with the disabled element are blocked by a dummy click handler.
3 changes: 0 additions & 3 deletions packages/circuit-ui/components/Button/base.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@
.base[disabled],
.base[aria-disabled="true"] {
color: var(--cui-fg-normal-disabled);

/* TODO: Remove in the next major version */
pointer-events: none;
cursor: not-allowed;
background-color: var(--cui-bg-highlight-disabled);
border-color: transparent;
Expand Down
2 changes: 0 additions & 2 deletions packages/circuit-ui/components/Button/base.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ describe('Button', () => {

const button = screen.getByRole('button');

expect(button).toBeDisabled();
expect(button).toHaveAttribute('aria-disabled', 'true');
});

Expand All @@ -81,7 +80,6 @@ describe('Button', () => {

const button = screen.getByRole('button');

expect(button).toBeDisabled();
expect(button).toHaveAttribute('aria-disabled', 'true');
});

Expand Down
4 changes: 0 additions & 4 deletions packages/circuit-ui/components/Button/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ export function createButtonComponent<Props>(
'aria-live': 'polite',
'aria-busy': Boolean(isLoading),
})}
// TODO: Remove in the next major version
{...(!isLink && {
disabled: isDisabled,
})}
{...(isDisabled && {
'aria-disabled': true,
})}
Expand Down

0 comments on commit cf297de

Please sign in to comment.