Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♿ a11y(bal-nav): button overlays not reachable via keyboard #1479

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace BalProps {
controls?: string
title?: string
label?: string
haspopup?: string
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/components/bal-button/bal-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export class Button implements ComponentInterface {
'aria-controls',
'aria-hidden',
'tabindex',
'aria-haspopup',
])
}

Expand Down Expand Up @@ -284,6 +285,7 @@ export class Button implements ComponentInterface {
'aria-label':
this.aria?.label || this.inheritAttributes['aria-label'] || this.aria?.title || this.inheritAttributes['title'],
'aria-controls': this.aria?.controls || this.inheritAttributes['aria-controls'],
'aria-haspopup': this.aria?.haspopup || this.inheritAttributes['aria-haspopup'],
}

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/bal-popover/bal-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ export class Popover implements ComponentInterface, Loggable, BalBreakpointObser

componentWillLoad() {
this.backdropHeight = this.getBackdropHeight()
this.triggerElement.setAttribute('aria-haspopup', 'true')
}

componentDidLoad() {
this.isInMainNav = this.footMobileNav !== null

if (this.triggerElement && this.menuElement) {
this.popperInstance = createPopper(this.triggerElement, this.menuElement, {
placement: this.tooltip ? 'bottom' : this.position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<bal-button
bal-popover-trigger
id="bal-popover-1-trigger"
aria-haspopup="true"
aria-controls="popover-menu"
color="is-info"
outlined
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utils/attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const trackingAttributes = ['data-tracking-style', 'data-tracking-topic', 'data-
* the `title` attribute that developers set directly on `bal-input`. This
* helper function should be called in componentWillLoad and assigned to a variable
* that is later used in the render function.
* This function also removes the attribute from the parent when its set on child.
*
* This does not need to be reactive as changing attributes on the host element
* does not trigger a re-render.
Expand Down