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

fix(chip): add tabIndex prop #1435

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

fix(chip): add tabIndex prop #1435

wants to merge 1 commit into from

Conversation

Birkbjo
Copy link
Member

@Birkbjo Birkbjo commented Nov 28, 2023


Description

Adds tabIndex to chip component.

I followed the pattern for the use of other tabIndex, but I wonder why this is a string and not number? Also in my opinion these tabindex should default to 0 - but they don't? So I decided to keep it aligned with other components.


Known issues

  • issue

Checklist

  • API docs are generated
  • Tests were added
  • Storybook demos were added

All points above should be relevant for feature PRs. For bugfixes, some points might not be relevant. In that case, just check them anyway to signal the work is done.


@Birkbjo Birkbjo requested a review from a team as a code owner November 28, 2023 14:13
@dhis2-bot
Copy link
Contributor

🚀 Deployed on https://pr-1435--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify November 28, 2023 14:17 Inactive
Copy link

cypress bot commented Nov 28, 2023

Passing run #3145 ↗︎

0 583 0 0 Flakiness 0

Details:

fix(chip): add tabIndex prop
Project: ui Commit: f22e62da90
Status: Passed Duration: 06:35 💡
Started: Nov 28, 2023 2:17 PM Ended: Nov 28, 2023 2:24 PM

Review all test suite changes for PR #1435 ↗︎

Copy link
Member

@cooper-joe cooper-joe left a comment

Choose a reason for hiding this comment

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

Nice 👍

This allows keyboard focus for the main chip body, but can we propagate that down to the <Remove> child component for removable type chips? Potentially out of scope here, so approved without this.

@Birkbjo
Copy link
Member Author

Birkbjo commented Nov 28, 2023

@cooper-joe thanks for your quick input. After testing this in storybook, it seems like this is not enough to actually make tabIndex useful. Because it's a span, an-enter-press will not fire onClick. So we would have to handle the keypresses manually, or refactor this to be a button.

The only problem of making this a button is if you wanted the chip to be a link - <a> wrapping a button is not valid HTML.

@cooper-joe
Copy link
Member

I would prefer this to be a button rather than hack together our own keypress handling. Alas, wrapping the chip in the link is exactly how it's being used, so looks like we may not have a choice unless we're prepared to release the breaking change. I'm open to the the breaking change, if it means a step towards better accessibility.

@Birkbjo Birkbjo marked this pull request as draft November 29, 2023 11:31
Base automatically changed from alpha to master December 8, 2023 17:28
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.

4 participants