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

Combobox: add translations and adjust buttons #3409

Merged
merged 9 commits into from
Dec 2, 2024
Merged

Conversation

HalvorHaugan
Copy link
Contributor

@HalvorHaugan HalvorHaugan commented Nov 27, 2024

Component Checklist 📝

  • JSDoc
  • Examples
  • Documentation / Decision Records
  • Storybook
  • Style mappings (@navikt/core/css/config/_mappings.js)
  • Component tokens (@navikt/core/css/tokens.json)
  • CSS class deprecations (@navikt/aksel-stylelint/src/deprecations.ts)
  • Exports (@navikt/core/react/src/index.ts and @navikt/core/react/package.json)
  • New component? CSS import (@navikt/core/css/index.css)
  • Breaking change? Update migration guide. Consider codemod.
  • Changeset (Format: <Component>: <gitmoji?> <Text>. E.g. "Button: ✨ Add feature xyz.")

Copy link

changeset-bot bot commented Nov 27, 2024

🦋 Changeset detected

Latest commit: 0896b88

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

This PR includes changesets to release 7 packages
Name Type
@navikt/ds-react Minor
@navikt/ds-css Minor
@navikt/ds-tokens Minor
@navikt/ds-tailwind Minor
@navikt/aksel-icons Minor
@navikt/aksel Minor
@navikt/aksel-stylelint Minor

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

Combobox: {
addOption: "Add",
searching: "Searching…",
maxSelected: "{selected} of max {limit} are selected.",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took the liberty of adding "max" to the text to make it clearer.

Copy link
Contributor

github-actions bot commented Nov 27, 2024

Storybook demo / Chromatic

📝 Endringer til review: 2

e502b415c | 91 komponenter | 135 stories

>
<span className="navds-sr-only">
{toggleListButtonLabel ?? "Alternativer"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Alternativer" doesn't tell me what the action does here. Would "open alternatives", "open optionlist" or something in that world make sense?

Copy link
Contributor Author

@HalvorHaugan HalvorHaugan Nov 27, 2024

Choose a reason for hiding this comment

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

I don't think we need this text, so I just removed it and deprecated toggleListButtonLabel. No one is currently using that prop, so maybe we can just remove it right away?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@it-vegard @KenAJoh Should we remove the prop toggleListButtonLabel entirely instead of just marking it as deprecated?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do it! Love removing unused props where possible ❤️

KenAJoh
KenAJoh previously approved these changes Nov 29, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@it-vegard Please have a look at the event changes I made here. I removed onKeyDown since that shouldn't work anyways. I also changed onPointerUp to onClick since it should work the same way, but is better practice. Do you think this is ok?

@@ -88,10 +94,9 @@ export const InputController = forwardRef<
onClick={clearInput}
className="navds-combobox__button-clear"
tabIndex={-1}
aria-hidden
Copy link
Contributor Author

@HalvorHaugan HalvorHaugan Dec 2, 2024

Choose a reason for hiding this comment

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

aria-hidden on button results in this error message in the console in Chrome:

Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
Element with focus: button

Wondering if I should use a div instead? 🤔

Copy link
Collaborator

@KenAJoh KenAJoh Dec 2, 2024

Choose a reason for hiding this comment

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

Since this and ToggleListButton are both aria-hidden, can the wrapper-div get aria-hidden to solve this?
Screenshot 2024-12-02 at 09 27 43

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't help

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there actually a reason to hide this element? In Search we opt to not hide it, so is there an actual difference in expected UX here?

Copy link
Contributor

@JulianNymark JulianNymark left a comment

Choose a reason for hiding this comment

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

:shipit:

@HalvorHaugan HalvorHaugan merged commit 1895f4f into main Dec 2, 2024
4 checks passed
@HalvorHaugan HalvorHaugan deleted the combobox-i18n branch December 2, 2024 11:55
@github-actions github-actions bot mentioned this pull request Dec 2, 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.

4 participants