Skip to content

fix(field): respect existing aria-invalid#4765

Merged
eirikbacker merged 5 commits intomainfrom
fix/field-aria-invalid
Apr 22, 2026
Merged

fix(field): respect existing aria-invalid#4765
eirikbacker merged 5 commits intomainfrom
fix/field-aria-invalid

Conversation

@eirikbacker
Copy link
Copy Markdown
Contributor

Summary

Checks

@eirikbacker eirikbacker self-assigned this Apr 21, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

🦋 Changeset detected

Latest commit: de2c363

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-web Patch
@digdir/designsystemet-react Patch
@digdir/designsystemet Patch
@digdir/designsystemet-css Patch
@digdir/designsystemet-types 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Preview deployments for this pull request:

storybook - 21. Apr 2026 - 15:37

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the ds-field web component to avoid overwriting a consumer-provided aria-invalid, aligning field validation behavior with manual accessibility control.

Changes:

  • Introduces an ATTR_INVALID constant and updates ds-field to only set aria-invalid when it is not already present.
  • Replaces VALIDATIONS tracking from a WeakMap to a WeakSet since prior attribute restoration is no longer needed.
  • Adds a changeset to release the fix as a patch for @digdir/designsystemet-web and @digdir/designsystemet-react.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/web/src/field/field.ts Stops overriding pre-existing aria-invalid and adjusts internal tracking accordingly.
.changeset/six-dragons-repair.md Publishes the behavior change as a patch release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/web/src/field/field.ts Outdated
Comment thread packages/web/src/field/field.ts
@eirikbacker eirikbacker marked this pull request as ready for review April 21, 2026 11:32
Copy link
Copy Markdown
Contributor

@unekinn unekinn left a comment

Choose a reason for hiding this comment

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

Implementation looks good to me, tested to be working in Udir's repo.

Comment thread .changeset/six-dragons-repair.md
Copy link
Copy Markdown
Collaborator

@oddvernes oddvernes left a comment

Choose a reason for hiding this comment

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

Seems good!

@eirikbacker eirikbacker merged commit 3223805 into main Apr 22, 2026
16 checks passed
@eirikbacker eirikbacker deleted the fix/field-aria-invalid branch April 22, 2026 09:24
@github-actions github-actions Bot mentioned this pull request Apr 22, 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.

6 participants