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

[Select] Retain the highlight state when closing #965

Closed
vladmoroz opened this issue Dec 5, 2024 · 2 comments · Fixed by #972
Closed

[Select] Retain the highlight state when closing #965

vladmoroz opened this issue Dec 5, 2024 · 2 comments · Fixed by #972
Labels
component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@vladmoroz
Copy link
Contributor

vladmoroz commented Dec 5, 2024

This is mostly a nit/polish item.
When closing the select, there's a frame of slight flicker/unnecessary motion:

Screen.Recording.2024-12-05.at.13.27.44.mov

Frame by frame:

  1. Right after clicking an option: there's a highlight on the clicked option (possibly retained from the hover). The previous value still has the indicator.
  1. Next frame: the check icon is moved to its new place, but the highlight is lost
  1. The popup is closed

Ideally:

  • If animated, I think we need to make sure that from frame (2), the highlight is set and persisted until mouse movement and/or popup is fully closed. When animating the popup, it should be animating with the newly highlighted item visible.
  • If not animated, the Select should close immediately without frame (2)

Search keywords:

@vladmoroz vladmoroz added component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature labels Dec 5, 2024
@atomiks
Copy link
Contributor

atomiks commented Dec 6, 2024

If not animated, the Select should close immediately without frame (2)

@michaldudak now I remember that's what the flushSync was for in Select - it skips that frame. Removing it causes the 1 frame flash.

Retaining the highlight would fix that though even if the frame is kept.

I suppose this currently removes it?

.Option[data-selected]:not([data-open]),
.Option[data-highlighted] {
  /* highlighted state */
}

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants