Skip to content

feat: @digdir/designsystemet-web#4409

Open
Barsnes wants to merge 309 commits intomainfrom
fix/designsystemet-web
Open

feat: @digdir/designsystemet-web#4409
Barsnes wants to merge 309 commits intomainfrom
fix/designsystemet-web

Conversation

@Barsnes
Copy link
Member

@Barsnes Barsnes commented Jan 20, 2026

resolves #1044
resolves #3348
resolves #4369
resolves #4433

Edit by @mimarz: Moved some links to resolving issues from other closed PRs which feat was moved to this PR instead.

Summary

First implementation of a new package that properly uses pure web, and has no dependencies like react.
Related to #1044

You can test this package with the npm tag test.


The preview comment is a bit buried, so putting links here as well:

Checks

@changeset-bot
Copy link

changeset-bot bot commented Jan 20, 2026

🦋 Changeset detected

Latest commit: eebc08c

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

github-actions bot commented Jan 20, 2026

Preview deployments for this pull request:

storybook - 16. Feb 2026 - 14:37

themebuilder - 16. Feb 2026 - 15:03

www - 16. Feb 2026 - 15:09

* The name of the person the avatar represents.
*/
'aria-label': string;
'aria-label'?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this intended to be optional?

I see we added lots of aria-labels in the stories and other places its used, so contradicting.

If its itended, suggest adding a changeset for this, or else change it back.

Copy link
Contributor

Choose a reason for hiding this comment

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

This one is trcky.
We should be able to do:

<Tooltip content='Ola Nordmann'>
    <Avatar tabIndex={0}>
    <img src='https://placebeard.it/100x100' alt='' />
  </Avatar>
</Tooltip>

...in this scenario, the Tooltip will set data-tooltip, which again sets aria-label. But, I'm not sure how to express this in Typescript? :(

Copy link
Member Author

Choose a reason for hiding this comment

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

what about adding data-tooltip to the props of Avatar?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, tried that, but it did not understand that it got tooltip from the parent <Tooltip> element :s
But, we can just have the user set data-tooltip for this component ☺️

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah that was my thoughs as well 🤔 Might be kind of weird, but at least we know sometimes when to not throw a type error

};

const handleAriaAttributes = debounce(() => {
for (const el of document.querySelectorAll('[data-tooltip]')) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe as this as a const as we have done in the other helpers?

Copy link
Contributor

Choose a reason for hiding this comment

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

unsure what you med by "Maybe as this as a const"
If you refer to the other selectors being getElementsByTagName, these can and should be const as they are "live" HTMLCollection - meaning it automatically contains all added children. querySelectorAll on the other hand is not live - it is a static snapshot, and thus needs to be evaluated on every run to actually contain the relevant elements :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking more in terms of code consistency. Like its done with ATTR_CLICKDELEGATEFOR in clickdelegatefor.ts (or ATTR_TOGGLEGROUP in tooglegroup).

The first const is the "main" data-attr for this function/observer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! Right, go ahead <3 :)

@mimarz
Copy link
Collaborator

mimarz commented Feb 16, 2026

We should update Select to set aria-readonly="true" instead of readonly to be correct html?

@eirikbacker
Copy link
Contributor

We should update Select to set aria-readonly="true" instead of readonly to be correct html?

Yes, supported 💯

@mimarz
Copy link
Collaborator

mimarz commented Feb 16, 2026

We should update Select to set aria-readonly="true" instead of readonly to be correct html?

Yes, supported 💯

Which means, in reality we can just deprecate readOnly prop and tell them to use aria-readonly instead 🥰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

6 participants