Skip to content

fix(tabs): onChange is not called when keyboard changes active tab#4616

Merged
Barsnes merged 5 commits intomainfrom
tabs/keyboard-controlled
Mar 17, 2026
Merged

fix(tabs): onChange is not called when keyboard changes active tab#4616
Barsnes merged 5 commits intomainfrom
tabs/keyboard-controlled

Conversation

@Barsnes
Copy link
Member

@Barsnes Barsnes commented Mar 12, 2026

Summary

resolves #4605

I seems like this is an issue for react.
We could just remove the trusted line, but this make sure it keep the same functionality as before, but calls onChange if the users keyboard changes the value.

I'm open to just removing the line, since we always want onChange to stay in sync with the actual active tab.

Checks

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Preview deployments for this pull request:

storybook - 16. Mar 2026 - 13:09

@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: 7980dce

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@digdir/designsystemet-react Patch
@digdir/designsystemet Patch
@digdir/designsystemet-css Patch
@digdir/designsystemet-types Patch
@digdir/designsystemet-web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mimarz
Copy link
Collaborator

mimarz commented Mar 13, 2026

We should test if this also fixes #4617

@Barsnes
Copy link
Member Author

Barsnes commented Mar 13, 2026

We should test if this also fixes #4617

Would be surprised if it does, since this does not stop the change event from our web component

@mimarz
Copy link
Collaborator

mimarz commented Mar 13, 2026

I'm open to just removing the line, since we always want onChange to stay in sync with the actual active tab.

If this is the best course, sure? Less complexity is always good :)

What was the problem with the onClick being done programmatically before?
Did we have this check pre v1.12.0?

@Barsnes Barsnes marked this pull request as ready for review March 16, 2026 12:06
@Barsnes Barsnes merged commit 5897dc3 into main Mar 17, 2026
16 checks passed
@Barsnes Barsnes deleted the tabs/keyboard-controlled branch March 17, 2026 11:09
@github-actions github-actions bot mentioned this pull request Mar 17, 2026
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.

Tabs: onChange isn't called when changing tab using keyboard

2 participants