Skip to content

Commit

Permalink
fix(a11y): set aria-haspopup when bal-popup button
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rc0z committed Jan 10, 2025
1 parent 567c987 commit f4b16b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-swans-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**a11y**: set aria-haspopup for popup buttons
13 changes: 13 additions & 0 deletions packages/core/src/components/bal-button/bal-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ export class Button implements ComponentInterface {
*/
@Prop() rounded = false

/**
* If `true` the button is a popup.
*/
@Prop() balPopup = undefined

/**
* Name of the left button icon
*/
Expand Down Expand Up @@ -174,6 +179,14 @@ export class Button implements ComponentInterface {
])
}

componentDidLoad() {
if (this.el.getAttribute('bal-popup') && !this.aria?.haspopup) {
this.aria = {
haspopup:"true"
}
}
}

componentDidRender() {
this.balDidRender.emit()
}
Expand Down

0 comments on commit f4b16b0

Please sign in to comment.