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] Only open dropdown onClick, not onFocus. #3440

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Dec 6, 2024

Description

This solves the issue where programmatic focus would open dropdown. This in turn would hide any error for the field in the cases that would be relevant.

Resolves #3437

The fix itself almost seems too simple to just "work", so will need some help reviewing edgecases that might have been forgotten. I didn't actually need to check for readOnly or disabled-state for it to work, but exit early anyways just incase we change that in the future.

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 Dec 6, 2024

🦋 Changeset detected

Latest commit: e80e933

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 Patch
@navikt/ds-css Patch
@navikt/ds-tokens Patch
@navikt/ds-tailwind Patch
@navikt/aksel-icons Patch
@navikt/aksel Patch
@navikt/aksel-stylelint 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

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Storybook demo

a46619918 | 91 komponenter | 135 stories

@HalvorHaugan
Copy link
Contributor

The list no longer closes after selecting an option in single select mode.

@KenAJoh
Copy link
Collaborator Author

KenAJoh commented Dec 18, 2024

The list no longer closes after selecting an option in single select mode.

@HalvorHaugan Should be fixed now 🤞

HalvorHaugan
HalvorHaugan previously approved these changes Dec 18, 2024
Copy link
Contributor

@HalvorHaugan HalvorHaugan left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +62 to +64
if (inputProps.disabled || readOnly) {
return;
}
Copy link
Contributor

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 technically need to check this, but it doesn't hurt either.

@@ -0,0 +1,5 @@
---
"@navikt/ds-react": minor
Copy link
Contributor

Choose a reason for hiding this comment

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

Would patch be more correct here? 🤔 Not sure myself.

@KenAJoh KenAJoh merged commit ae9e623 into main Dec 18, 2024
3 checks passed
@KenAJoh KenAJoh deleted the combobox-focus-opening branch December 18, 2024 14:29
@github-actions github-actions bot mentioned this pull request Dec 18, 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.

[Innspill til komponent]: <Combobox /> - Åpning av liste
2 participants