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: Don't scroll when moving virtual focus with mouse #3265

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

HalvorHaugan
Copy link
Contributor

@HalvorHaugan HalvorHaugan commented Oct 21, 2024

Description

If you move the mouse to the top of the list, it will sometimes scroll up. Especially in Firefox.
Problem was introduced here. Here I have tried to solve the original problem a different way. (The original problem was that scrollIntoView didn't work when calling it right after toggleIsListOpen(true) since the list wasn't visible yet.)

Component Checklist 📝

  • JSDoc
  • Examples
  • Documentation
  • 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 Oct 21, 2024

🦋 Changeset detected

Latest commit: b1de8b0

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

@HalvorHaugan HalvorHaugan changed the title Combobox: Don't scroll when browsing list with mouse Combobox: Don't scroll when moving virtual focus with mouse Oct 21, 2024
Copy link
Contributor

github-actions bot commented Oct 21, 2024

Storybook demo

bc5703c57 | 91 komponenter | 144 stories

@JulianNymark
Copy link
Contributor

Thinking of adding a small change to this branch as well, so the "offset" in the filteredOptions is only applied to lists where the max is reached (which is the reason we have the offset).

@HalvorHaugan HalvorHaugan marked this pull request as ready for review October 22, 2024 11:38
@HalvorHaugan HalvorHaugan merged commit ddf9f9b into main Oct 23, 2024
4 checks passed
@HalvorHaugan HalvorHaugan deleted the combo-vf-scrollfix branch October 23, 2024 07:44
@github-actions github-actions bot mentioned this pull request Oct 23, 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.

3 participants