Repository navigation
v0.15.0
The tenth Fluent UI v9 parity release: Phase 10 of the roadmap, motion on components. Dialogs scale and fade in, drawers slide from their edge and inline drawers open their space, Popover, Menu, InfoButton's note and TeachingPopover fade and slide away from their anchor, Accordion panels, Tree groups and Nav categories collapse, toasts and the new MessageBarGroup let their neighbours glide when one comes or goes, TabList slides its selection line and Carousel can cross-fade. Every motion is Tailwind classes on the presence core's data-presence phases, timed with Fluent's motion tokens and off under prefers-reduced-motion; a bundle that animates nothing holds no motion code (verify-dist proves it for an import of only Button). Each animated part takes a motion slot (motion, backdropMotion, expandIconMotion, indeterminateMotion: unset is the default motion, null none, a class string or { className } yours), and WaveProvider motion="none" turns every default off. An exiting surface is inert, and focus, dismiss layers, the focus trap, the isolation and the scroll lock are released when it closes, not when its motion ends. It closes the twelve gaps of P10-01 and P10-02 (foundation-13, dialog-5, drw-4, acc-6, tree-4, toast-5, nav-8, messagebargroup-1, foundation-15, car-3, tab-5, progress-6). Nothing public was removed and every type only widens, but with no motion prop the surfaces animate, so an unchanged page looks different in a browser: read "Upgrading from 0.14" before upgrading if your end-to-end tests wait for elements to disappear or your styles select Wave's DOM.
Upgrading from 0.14
- Surfaces animate by default in a browser. A closed Dialog, Drawer, NavDrawer, Menu, Popover, InfoButton note, Tooltip or TeachingPopover stays in the document for its exit (100 to 500 ms, by surface and size),
inert, withdata-presence="exiting"(anddata-state="closed"on the popups); focus, the dismiss layer, the trap, the isolation and the scroll lock are released at once. End-to-end tests that look for an element's absence right after a close wait for it, or render under<WaveProvider motion="none">. Unit tests in jsdom are unaffected: Vitest loads no CSS, so every phase ends at once (hold one withmockAnimations). - Popover.Content, the Tooltip surface and the TeachingPopover surface mount through the presence core: they render
data-presenceanddata-state(open, andclosedwhile they exit), andinertwhile they exit. A popover named by its trigger keeps noaria-labelledbywhile it exits (it isinertand out of the accessibility tree then). defaultOpensurfaces animate in on a client render too (0.14: only after hydration): Dialog, an overlay Drawer and NavDrawer, Menu, Popover, Tooltip, InfoButton and TeachingPopover mount withappear, so the same page behaves the same whichever way it rendered.motion={null}restores 0.14. In-flow content (inline drawers, Accordion, Tree, Nav, the bars a MessageBarGroup mounts with) never animates on mount.- New wrapper elements.
div.wave-accordion-panel__collapsearound Accordion's region;div.wave-tree-item__collapsearound a Tree group;div.wave-nav-category__collapsearound a Nav category's list;div.wave-drawer__collapse(andwave-nav-drawer__collapsefor NavDrawer) around an inline panel;div.wave-toaster__toast-contentinside each toast container. The first four aredisplay: contentswhile open, so layout is unchanged then; selectors with a child combinator across them (.wave-accordion-item > [role=region],li > ul,[role=treeitem] > [role=group], a flex rule on an inline drawer's parent's direct children during the motion) and tests that walkparentElementornextElementSiblingchange. While a wrapper enters or exits it is a clipping grid of one track, whichever motion runs (the default, amotionof yours, or 0.14 classes on an inline drawer'sclassName, item 6): a slide of yours on the part is clipped by it, and an inline drawer whose width (height at the bottom) is a percentage inclassName, orsize="full"animated by 0.14 classes, resolves it against the track for that time and is right again once open. Give such a drawer a length, or passmotion={null}. - The toast container is a one-cell grid around the new content element (
wave-toaster__toast-content, which holds the status text and the content); itsdata-wave-toastmarker, classes and attributes are unchanged. A test that reads the status text as the container's first child walks one level deeper. - A
classNamewithdata-[presence=…]classes onMenu.Popover,Dialog.Content, Drawer or NavDrawer keeps 0.14's behaviour whilemotionis unset: that part gets no default motion, so your classes animate it unmixed (an inline drawer's presence core waits for its<aside>, as in 0.14). Moving those classes tomotionis the recommended form. The rule covers the part, not its backdrop: a Dialog, Drawer or NavDrawer animated that way now also fades its backdrop by default (backdropMotion={null}keeps 0.14's backdrop), and a backdrop animated through thebackdropslot'sclassNamegets the default fade beside your classes (move them tobackdropMotion). CSS of yours keyed on the phases is not covered either: rules on.wave-toaster__toast[data-presence=…](the 0.8 to 0.14 way to animate toasts) now run beside the toasts' default motion, and atransitionshorthand of yours can reset the recipe's property list, so pass<Toaster motion={null}>or move them tomotion; the same holds for rules on InfoButton's and InfoLabel's note ([data-wave-infolabel-surface][data-presence=…]), wheremotion={null}on InfoButton or InfoLabel keeps 0.14's. - TabList's selected indicator is drawn by the selected tab's
::afterover a transparent 2px border (the tab's box is unchanged), the tab isrelative, and every tab of thetransparentappearance carriesborder-transparent forced-colors:border-[Canvas]. A class that recoloured the indicator through the tab's bottom (start) border targets theafter:border now (after:border-b-…, verticalafter:border-s-…); a border colour of yours left on the tab shows at once under the newly selected tab while the line slides there. - Focus in a closing panel moves to its trigger (Accordion's trigger, the Tree item, the Nav category's button), in the closing commit; 0.14 unmounted the content and focus fell to
<body>. - Behaviour fixes visible during exits: a stacked dialog's backdrop stays transparent while it fades, Dialog's title padding holds, and TeachingPopover stays visible while it exits (see Fixed).
- Carousel's slide curve is the
easy-easetoken (was Tailwind'sease-in-out), same 300 ms, and the root rendersdata-motion. Nav.Category's chevron turns with theeasy-easetoken too (was Tailwind's default curve), same 150 ms, and its transition is a motion slot (expandIconMotion): belowWaveProvider motion="none"it turns at once, while Accordion's and Tree's chevrons, which have no slot, keep their transitions. - Nav item actions fade in over 150 ms (were instant), and at once below
motion="none"and under reduced motion. Their children's transition list is set by the reveal, so a transition class of yours on an action is replaced. - Types:
WaveContextValuehas a new member,motion(MotionPreference); a hand-built value (a test mock ofuseWaveTheme) adds it. - New attributes, always rendered:
data-presenceon the new wrappers and on Popover.Content, the Tooltip surface and the TeachingPopover surface;data-stateon those three surfaces; Carousel'sdata-motion. A test that compares an element's full HTML or attribute list changes.
Added
- Default motion on the overlays and disclosures below, with Fluent's motion tokens (the guide's "Component Motion" section lists the classes); the listbox popups of Combobox, Dropdown, TagPicker and TimePicker, the DatePicker calendar and the AvatarGroup popover still appear and disappear at once (ROADMAP §8.5):
- Dialog: the surface scales up from 85% and fades in over 250 ms (decelerating), and out over 200 ms (accelerating); the backdrop fades over the same times, so it never outlasts the surface.
- Drawer and NavDrawer: an overlay panel slides in from its edge by its own size (
startandendmirrored in right-to-left layouts,leftandrightnot) and fades, over 250, 300, 400 or 500 ms bysize, both ways, with its backdrop fading over the same time; an inline drawer opens and closes the space it takes in the layout while its panel fades, held at its size against its inner edge, so the page beside it never reflows inside it (afullinline drawer has no motion: its size is its container's). - Popover.Content,
Menu.Popoverand its submenus, the InfoButton note and the TeachingPopover surface: a fade and a 4px slide away from the anchor, on the side the surface opened on (data-side), 200 ms in, 100 ms out; a TeachingPopover rendered in place only fades. Positioned surfaces never transitiontransform, so they never glide from their last position. - Tooltip: a fade, 100 ms both ways (Fluent's Tooltip has no motion). Shown again during its exit, it returns to
enteringon the same element. - Accordion panels, Tree groups and Nav categories: the part's space opens from nothing and closes back while it fades, 200 ms both ways; the part keeps its width and its line breaks, and a nested Tree group goes with its parent. A pointer click that falls through an exiting Tree group onto its item (an
inertelement lets the pointer through) neither expands nor activates the item; Enter and a screen reader's click still do. - Toasts: a toast opens its place in the stack, fades in and slides 8px in from the stack's edge over 250 ms; dismissed, it fades over 200 ms, then its place closes over 200 ms more, so the toasts around it glide and nothing jumps when it unmounts. The timer still starts when the toast is shown.
- Nav item actions fade in and out over 150 ms as their row is hovered or takes focus.
- Under
prefers-reduced-motion: reduceevery surface and part above appears and disappears at once, as the presence core already ended every phase at once.
- Motion slots (
MotionSlot: a class string or{ className }), each typedMotionSlot | null, named after the Fluent prop in its JSDoc:motiononDialog.Content, Drawer, NavDrawer,Menu.Popover,Popover.Content, InfoButton, InfoLabel (passed to its button), Tooltip, TeachingPopover (the surface it renders) andTeachingPopover.Surface,Accordion.Panel, Tree (every group),Nav.Category, Toaster (every toast container), MessageBarGroup and TabList;backdropMotiononDialog.Content, Drawer and NavDrawer;expandIconMotiononNav.Category;indeterminateMotionon ProgressBar. Unset keeps the default;nullturns it off (a part with presence phases still renders them, and they end at once); a value replaces the default classes, also belowWaveProvider motion="none". A replacement's classes must exist in your CSS: on the precompiled./stylesonly Wave's own classes do, so there a replacement names a class of your own written against[data-presence]. WaveProvider motion(MotionPreference:'default'or'none', inherited by nested providers liketheme):'none'makes every motion slot below it act asnulland turns off Carousel's slide or fade (unless the Carousel sets its ownmotion) and the Nav item actions' reveal; a part's own value still wins, and transitions that are no slot keep running (the Accordion and Tree chevrons, colour changes) (Fluent'sMotionBehaviourProviderwith'skip').useWaveTheme()returns it asmotion.MessageBarGroup(MessageBarGroupProps; Fluent'sMessageBarGroup), a component of its own so that an import of only MessageBar holds no presence code: a stack of MessageBars (8px gap) that keeps a removed bar in its place,inert, while it fades out and its row closes over 250 ms, so the bars below glide up;animate('exit-only', the default, or'both': a bar added after mount opens its row and fades in) rendersdata-animate, andmotionreplaces the bars' motion (both directions). It follows its children bykey: a reordered bar moves without a remount, and a bar that comes back during its exit is shown again. Bars present at its first render (on the server too) never animate. The exit's negative bottom margin matches the group's own 8px gap: another gap inclassNameneeds amotionwhose margin matches it. When a bar leaves with focus inside it, focus moves to the first tabbable element of the nearest remaining bar after it that has one, else before it. A child without a key of its own, or text, renders after the bars without motion, with a development warning.- Carousel
motion(CarouselMotion:'slide', the default,'fade', ornull; Fluent'smotion) andmotionDuration(milliseconds,300by default; Fluent'sdurationis Embla's unitless speed, so a value ported from Fluent is far too short).fadecross-fades the slides in place (one slide per page: withgroupSizeabove 1 or'auto'the slides slide, with a development warning; a drag still pages on release, the slides do not follow the pointer). The root rendersdata-motion(slide,fadeornone); belowWaveProvider motion="none"the carousel moves only with its ownmotion. - TabList slides its selection line (the
transparentappearance) from the tab selected before to the new one, over 300 ms with the max decelerating curve, horizontal and vertical, in both directions;motionreplaces or (null) turns it off, a WaveUI addition (Fluent has no switch). The line starts from two custom properties the TabList writes for one frame (with Carousel'smotionDuration, one of the two inline styles this release adds); under reduced motion it moves at once. - ProgressBar
indeterminateMotion(Fluent's name): the default is 0.14's sweep, class for class;null(ormotion="none") draws a static full-width fill, never a partial one that would read as progress. Nav.Category expandIcon(an optional indicator:nullandundefinedkeep the chevron,falseor content that renders nothing hides it; a glyph of yours is not turned, so a plus or a minus picked fromopenCategoriesworks; a<button>orButtonpassed there is unwrapped, with a development warning) andexpandIconMotion(the transition of the chevron's half turn, 150 ms;nullmakes the turn snap).- Types
MotionSlot,MotionPreference,CarouselMotionandMessageBarGroupProps. - Stable class names:
messageBarGroupClassNames(root,item: the element around each bar), and new keyscollapseonaccordionPanelClassNames,treeItemClassNames,navCategoryClassNames,drawerClassNamesandnavDrawerClassNames(an inline NavDrawer's element carries both), andtoastContentontoasterClassNames. - Development warnings (keys):
MessageBarGroup:children,Carousel:fade-group,Nav.Category:expandIcon-button. - Stories: a
Motionstory for every animated component (the default,nulland a replacement; Drawer alsoInlineMotion), MessageBarGroup'sExitOnly,AnimateBothandMotion, Nav'sCustomExpandIconand Presence'sProviderMotionNone; Menu'sExitMotionpasses its classes tomotion.
Changed
Behaviour
- The overlays and disclosures listed under Added animate (not yet the listbox popups of Combobox, Dropdown, TagPicker and TimePicker, the DatePicker calendar and the AvatarGroup popover) and stay mounted,
inert, while it exits (see "Upgrading from 0.14", 1 to 3). Positioning keeps its last coordinates while a popup exits; a second click during a Dialog's exit reaches the page (an exiting surface is click-through, asinertis); the page's scroll bar returns as a modal starts to fade, since the scroll lock lifts at close. A popup whose placement flips (Popover,Menu.Popover, the InfoButton note, a TeachingPopover with a target) starts its enter slide from the requested side, so its first frame is 4px off toward its anchor; the exit uses the resolved side (a known limit, ROADMAP §8.5). A selection changed while TabList's line still slides makes the line jump to the previous tab first (ROADMAP §8.5). - Popover.Content, Tooltip and TeachingPopover mount through the presence core (in 0.14 they unmounted at once), and Accordion, Tree and Nav collapse through it.
- Focus in a closing Accordion panel, Tree group or Nav category list moves to its trigger in the closing commit; focus in a closing Popover, InfoButton note or TeachingPopover moves out in the closing commit, as
Menu.Popover's does (see Fixed). - Carousel's slide curve, Nav's chevron curve and Nav item actions (see "Upgrading from 0.14", 10 and 11).
DOM structure
- The wrappers, the toast content element, TabList's
::afterindicator and the new attributes of "Upgrading from 0.14", 4, 5, 7 and 13.
Types
WaveContextValuegainsmotion("Upgrading from 0.14", 12), and the components listed under Added gain optional props; no type narrows.
Development messages
- The texts of
Dialog.Content:backdrop-ignored,Drawer:backdrop-ignoredandNavDrawer:backdrop-ignorednamebackdropMotionnext tobackdrop(keys unchanged), and abackdropMotioncounts as given unless it isundefined, sobackdropMotion={null}on a non-modal or inline surface warns too.TeachingPopover:surface-propslistsmotionamong the props a Surface takes instead (a test that asserts a full text updates it).
Dev gates
- The conventions gate scans
src/lib/motion.tstoo and gains two rules:presence-class(adata-[presence=…]class anywhere butsrc/lib/motion.ts, where every motion of the library lives) andstarting-gate(astarting:class not gated ondata-[presence=entering]); the stop hook runs it forsrc/lib/motion.ts. src/lib/__tests__/motion.test.tschecks every recipe: each class compiles with@tailwindcss/node(now a devDependency), a transition has Wave's duration and curve tokens and a same-elementmotion-reduce:counterpart, everystarting:class is gated, positioned surfaces never transitiontransform, backdrops end with their surface, and the grid structures pin both tracks at a zero minimum and align their track with their part.verify-dist: an import of onlyButtonholds nolib/motionorhooks/useMotionmodule, no recipe literal (MOTION_RECIPE_MINof them are read fromdist/lib/motion.mjs) and no[presence=in its code, with positive controls for Dialog, Accordion and MessageBarGroup; an import of only MessageBar holds no presence core and no presence group; the module-only list gains the motion internals.build-cssrequires three motion utilities indist/styles.css.- Test helpers:
motionClasses(recipe),honourInert()(focus()that skipsinertelements, as a browser does) andrenderWithProviders(ui, { motion }).
Deprecated
- Nothing new is deprecated.
Fixed
- A stacked dialog's backdrop stays transparent while it exits. 0.14 flipped the upper dialog's backdrop to dimmed as it closed (its layer was gone), so a dialog animated with classes dimmed the page twice during its exit; the backdrop now keeps the appearance it had while open.
- Dialog's title padding holds through the exit. The titles' end padding, which follows the width of the title actions, fell back to 2rem as the dialog closed, so a title could re-wrap while the surface faded.
- Focus leaves a closing Popover, InfoButton note or TeachingPopover in the closing commit (as
Menu.Popover's has since 0.7), to its opener or its trigger. So a Dialog opened from a button in a popover, in the same update that closes it, records the popover's trigger as its opener and returns focus there, not to theinertbutton. - TeachingPopover stays visible while it exits. Its surface is hidden until floating-ui has placed it, and floating-ui resets that on close; the surface now keeps its last placement, and the last step it showed, through the exit.
Size
Against 0.14.1 as published on npm, measured the way 0.8.0 to 0.11.0 were: dist/styles.css as built, and minified Vite builds of an entry that imports from dist/index.mjs, with bare imports external (verify-dist's probeSizeBudget). Both versions were measured with this release's build tools (0.14.1 from its npm package). Sizes are in KiB (1,024 bytes):
| Output | 0.14.1 | 0.15.0 |
|---|---|---|
dist/styles.css |
82.4 KiB (14.0 KiB gzip) | 95.3 KiB (15.3 KiB gzip) |
dist/lib/motion.mjs (new, as built) |
— | 9.7 KiB (1.4 KiB gzip) |
An import of only Button |
10.9 KiB (3.8 KiB gzip) | 10.9 KiB (3.8 KiB gzip) |
An import of only Dialog |
68.0 KiB (22.8 KiB gzip) | 69.1 KiB (23.2 KiB gzip) |
An import of only Drawer |
75.8 KiB (25.0 KiB gzip) | 80.8 KiB (25.8 KiB gzip) |
An import of only NavDrawer |
68.9 KiB (23.2 KiB gzip) | 73.9 KiB (23.9 KiB gzip) |
An import of only Menu |
84.0 KiB (28.4 KiB gzip) | 85.2 KiB (28.7 KiB gzip) |
An import of only Popover |
50.4 KiB (17.3 KiB gzip) | 55.2 KiB (18.9 KiB gzip) |
An import of only Tooltip |
21.9 KiB (8.5 KiB gzip) | 25.4 KiB (9.8 KiB gzip) |
An import of only InfoButton |
38.9 KiB (13.6 KiB gzip) | 40.8 KiB (14.0 KiB gzip) |
An import of only TeachingPopover |
65.3 KiB (22.4 KiB gzip) | 70.4 KiB (24.1 KiB gzip) |
An import of only Accordion |
10.3 KiB (4.3 KiB gzip) | 16.4 KiB (6.5 KiB gzip) |
An import of only Tree |
40.9 KiB (14.0 KiB gzip) | 46.1 KiB (15.8 KiB gzip) |
An import of only Nav |
18.5 KiB (6.7 KiB gzip) | 31.5 KiB (10.7 KiB gzip) |
An import of Nav and Button |
25.4 KiB (8.5 KiB gzip) | 31.5 KiB (10.7 KiB gzip) |
An import of only Toaster |
37.6 KiB (13.3 KiB gzip) | 39.5 KiB (13.7 KiB gzip) |
An import of only MessageBar |
26.2 KiB (9.1 KiB gzip) | 26.2 KiB (9.1 KiB gzip) |
An import of only MessageBarGroup |
— | 12.1 KiB (4.8 KiB gzip) |
An import of only Carousel |
38.3 KiB (13.9 KiB gzip) | 39.0 KiB (14.2 KiB gzip) |
An import of only TabList |
30.6 KiB (11.0 KiB gzip) | 33.3 KiB (11.9 KiB gzip) |
An import of only ProgressBar |
6.2 KiB (2.5 KiB gzip) | 6.7 KiB (2.7 KiB gzip) |
| An import of everything | 619.2 KiB (195.5 KiB gzip) | 636.1 KiB (199.6 KiB gzip) |
- An import of only
Buttonis byte for byte the size of 0.14.1's (11,195 bytes minified, 3,855 gzip), andverify-distgates that it holds no motion module, no recipe and no presence class. An import of onlyMessageBaris unchanged too (26,831 bytes): the presence group is inMessageBarGroup. - A bundle holds only the recipes its components use:
lib/motion.mjsis one module of plain strings, and the bundler drops the others.dist/styles.cssgrew by the motion classes (12.9 KiB, 1.3 KiB gzip). - Popover, Tooltip and TeachingPopover now hold the presence core (they moved onto it) and, the popups, the focus-before-close hook; Accordion, Tree and Nav hold the presence core, the collapse hook and
usePreserveFocus. Navalso holds Button's modules (Button,Button.slots,Button.semantics,buttonStyles): its newexpandIconunwraps a<button>orButtonglyph throughunwrapButtonGlyph, as every glyph slot does (C-SLOTS). An app that already renders a Button pays the rest only:NavwithButtongrew from 25.4 to 31.5 KiB.