Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The scenario
I noticed that dropdowns (both
flux:menuandflux:navmenu) and tooltips just pop in and out, while modals, flyouts and toasts already have a nice little transition. Next to them, these overlays feel a bit abrupt. Most UI kits I've used animate them by default, and I think it would make Flux feel even more polished.The proposal
Give dropdowns and tooltips a short transition by default, timed like the modal's, and add one prop that turns transitions off on any component that has them:
With
prefers-reduced-motion: reduce, every one of these keeps its fade and drops its movement.Since it's the default, dropdowns and tooltips start transitioning in every app after upgrading.
The solution
This is CSS only, plus the prop in five templates:
dropdown,tooltip,modal,toastandtoast.group. The prop rendersdata-flux-no-transition, the same way:dismissible="false"rendersdisable-click-outside.flux:menu,flux:navmenu,flux:tooltiphover andtoggleable) fade in and slide 4px away from their trigger. They use the modal's technique (@starting-style, plusallow-discreteondisplayandoverlay) and its timings (0.15s in, 0.075s out). Submenus stay instant.transform, so that one is overridden with!important, only under reduced motion and only on the toast card. The stack positions are untouched.@layer base, sotransition-noneand other utilities still override them. The opt-out only affects its own component: an opted-out modal leaves the dropdowns inside it alone.The same approach can be extended to the Pro components that open a popover, like the date and time pickers, the listbox and combobox selects.
flux-transitions-before-after.mp4
Verification
Tested in Chrome, Firefox and Safari:
:transition="false"