Skip to content

Commit a42ad12

Browse files
♿ a11y(bal-hint, bal-field-hint): hints are not accessible via Keyboard & Screenreader (#1637)
* Create PR for #1629 * a11y(bal-hint): support keyboard actions -tab: to focus -enter/space: to open popover * a11y(bal-hint): support keyboard actions -tab: to focus -enter/space: to open popover * a11y(bal-hint): run format * a11y(bal-hint): use helper, fix text in changeset --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Magdalena Marinkov <[email protected]>
1 parent 7afef3c commit a42ad12

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/famous-hats-appear.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@baloise/ds-core': minor
3+
---
4+
5+
**hint**: support keyboard actions: tab to focus, enter/space to open popover

packages/core/src/components/bal-hint/bal-hint.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { BEM } from '../../utils/bem'
1414
import { preventDefault } from '../bal-select/utils/utils'
1515
import { BalScrollHandler } from '../../utils/scroll'
1616
import { ListenToBreakpoints, BalBreakpointObserver, BalBreakpoints, balBreakpoints } from '../../utils/breakpoints'
17+
import { isEnterKey, isSpaceKey } from '../../utils/keyboard'
1718

1819
@Component({
1920
tag: 'bal-hint',
@@ -160,7 +161,9 @@ export class Hint implements ComponentInterface, BalConfigObserver, BalBreakpoin
160161
aria-haspopup="true"
161162
role="button"
162163
name="info-circle"
164+
tabindex={0}
163165
onClick={() => this.toggle()}
166+
onKeyDown={event => (isEnterKey(event) || isSpaceKey(event)) && this.toggle()}
164167
></bal-icon>
165168
)
166169
}

0 commit comments

Comments
 (0)