Skip to content

Fix set aria selected #78

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

Merged
merged 4 commits into from
Feb 19, 2024
Merged

Fix set aria selected #78

merged 4 commits into from
Feb 19, 2024

Conversation

keithamus
Copy link
Contributor

This fixes a regression in v4 that didn't have requisite tests; adding aria-selected=true on a tab should make that the default selected tab.

The problem is that we determined the index before properly setting up the tabs. We can instead defer selecting the default index and ensure that it is determined when the setup code is run.

Additionally, to make things even easier, this now accepts a default-tab attribute which it will attempt to use if present.

@keithamus keithamus requested a review from a team as a code owner February 19, 2024 11:56
Copy link
Member

@owenniblock owenniblock left a comment

Choose a reason for hiding this comment

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

Nice!

@@ -31,6 +31,8 @@ import '@github/tab-container-element'
</tab-container>
```

If none of the tabs have `aria-selected=true`, then the first tab will be selected automatically. You can also add the `default-tab=N` attribute to avoid having to set `aria-selected=true` on the desired tab.
Copy link
Member

Choose a reason for hiding this comment

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

Should we specify that N is a 0-based index value here?

@keithamus keithamus merged commit 7a8fa4a into main Feb 19, 2024
@keithamus keithamus deleted the fix-set-aria-selected branch February 19, 2024 12:00
@keithamus keithamus mentioned this pull request Feb 19, 2024
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.

2 participants