Skip to content

Commit

Permalink
Add ability to use a11y-disabled and maintain default disabled styling (
Browse files Browse the repository at this point in the history
#691)

* feat(btn): a11y-disabled remove disabled attr, checks to see if aria-disabled is being used and if so removes the disabled attribute

* chore: add changeset
  • Loading branch information
sirrah-tam committed Mar 4, 2024
1 parent fda9018 commit 8ca6aeb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-lizards-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@ithaka/pharos': patch
---

Add ability to use a11y-disabled and maintain default disabled styling
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ export const Base = {
href={args.href}
hreflang={args.hreflang}
a11yLabel={args.a11yLabel}
a11yPressed={args.a11yPressed}
a11yExpanded={args.a11yExpanded}
a11yDisabled={args.a11yDisabled}
a11yHaspopup={args.a11yHaspopup}
large={args.large}
isOnBackground={args.isOnBackground}
ping={args.ping}
pressed={args.pressed}
target={args.target}
type={args.type}
variant={args.variant}
Expand Down
2 changes: 1 addition & 1 deletion packages/pharos/src/components/button/pharos-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export class PharosButton extends ScopedRegistryMixin(FocusMixin(AnchorElement))
name="${ifDefined(this.name)}"
value="${ifDefined(this.value)}"
?autofocus=${this.autofocus}
?disabled=${this.disabled}
?disabled=${this.a11yDisabled ? false : this.disabled}
type="${ifDefined(this.type)}"
aria-label=${ifDefined(this.a11yLabel)}
aria-pressed=${ifDefined(this.a11yPressed)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const Base = {
a11y-label=${ifDefined(args.a11yLabel)}
a11y-expanded=${ifDefined(args.a11yExpanded)}
a11y-pressed=${ifDefined(args.a11yPressed)}
a11y-disabled=${ifDefined(args.a11yDisabled)}
?large=${ifDefined(args.large)}
?is-on-background=${ifDefined(args.isOnBackground)}
ping=${ifDefined(args.ping)}
Expand Down

0 comments on commit 8ca6aeb

Please sign in to comment.