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

[EuiBetaBadge] Improved the accessibility experience of EuiBetaBadge component #7805

Merged
merged 5 commits into from
May 31, 2024

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented May 31, 2024

Closes: #7791

Summary

Remove role=button for cases when the user doesn't provide an onClick or href attribute. In that mode, the component only shows the tooltip

@alexwizp alexwizp marked this pull request as ready for review May 31, 2024 16:20
@alexwizp alexwizp requested a review from a team as a code owner May 31, 2024 16:20
@cee-chen
Copy link
Contributor

The role=button attribute does not look correct for this case because, in fact, the user did not pass href or onClick attributes.

Just to confirm my understanding of this role, it only applies for click events? I assumed it was there because the tooltip applies a focus event (the tooltip shows on keyboard focus). Is that not sufficient for a button role?

@alexwizp alexwizp changed the title fix: [EuiTabs ][A11Y] - Using EuiBetaBadge within EuiTab Improved the accessibility experience of EuiBetaBadge component May 31, 2024
@alexwizp alexwizp changed the title Improved the accessibility experience of EuiBetaBadge component [EuiBetaBadge] Improved the accessibility experience of EuiBetaBadge component May 31, 2024
@alexwizp
Copy link
Contributor Author

alexwizp commented May 31, 2024

@cee-chen, it's a good question. In my understanding, no, and it's in line with what we already have in EuiIconTip.
Actually, this component behaves like a regular tooltip, whose main event is an action on hover. Adding tabIndex for opening it via the keyboard does not make it a button. On the other hand, https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role things are not so straightforward.

@dave-gus, do you have any ideas here?

@cee-chen
Copy link
Contributor

cee-chen commented May 31, 2024

Ooo actually the MDN link is super helpful, I probably should have just looked that up first! Thank you Alexey!

Note: If using role="button" instead of the semantic <button> or <input type="button"> elements, you will need to make the element focusable and define event handlers for click and keydown events

The tooltip triggers do not have click/keydown handles, only focus, so IMO that does qualify them as not fully buttons. Let's go ahead and make this change. Also great point that EuiIconTip doesn't behave this way!

Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Thanks again for the amazing a11y discussions and contributions Alexey!

@cee-chen cee-chen enabled auto-merge (squash) May 31, 2024 16:50
@kibanamachine
Copy link

Preview staging links for this PR:

@cee-chen cee-chen merged commit 11006c3 into elastic:main May 31, 2024
5 checks passed
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cee-chen added a commit to elastic/kibana that referenced this pull request Jun 3, 2024
`v94.5.2` ⏩ `v94.6.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

---

## [`v94.6.0`](https://github.com/elastic/eui/releases/v94.6.0)

- Updated `EuiComboBox` to support rendering `option.append` and
`option.prepend` in group labels
([#7800](elastic/eui#7800))

**Accessibility**

- Improved the accessibility experience of `EuiBetaBadge`
([#7805](elastic/eui#7805))
rohanxz pushed a commit to honeyn303/kibana that referenced this pull request Jun 4, 2024
`v94.5.2` ⏩ `v94.6.0`

[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)

---

## [`v94.6.0`](https://github.com/elastic/eui/releases/v94.6.0)

- Updated `EuiComboBox` to support rendering `option.append` and
`option.prepend` in group labels
([elastic#7800](elastic/eui#7800))

**Accessibility**

- Improved the accessibility experience of `EuiBetaBadge`
([elastic#7805](elastic/eui#7805))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiTabs ][A11Y] - Using EuiBetaBadge within EuiTab
4 participants