Repository navigation
feat(forms): animate checked and selected states only for a user change - #2639
Open
rkaraivanov wants to merge 3 commits into
Open
rkaraivanov wants to merge 3 commits into
rkaraivanov wants to merge 3 commits into
Conversation
A checkbox, switch, radio, toggle button, list item and navigation drawer item now animate only a change that the user makes, as the chip does since #2629. So does the label of an input, textarea or date input. A change from code and the first render show at once, so a virtualized list no longer animates its rows while it scrolls. In a fast scroll of 5000 rows with a checkbox, a switch and a radio, style recalc dropped from 979 ms to 187 ms. A change that a component makes for the user also animates: the radio that a group unchecks, the toggle that a single selection deselects, the items of a tree cascade, and the options and input of a combo or select. A value that app code sets, also in an igcChange handler, shows at once. Hover, focus and the invalid state still fade. With prefers-reduced-motion: reduce, these controls have no transitions of their own. The Material switch no longer plays its thumb keyframes. The shared logic is in src/animations/value-state.ts, and the chip now uses it.
5 tasks done
simeonoff
reviewed
Nov 20, 2026
simeonoff
left a comment
Member
There was a problem hiding this comment.
The core design is solid: one-frame user marks, instant marks that clear in a quiet frame, and joining for framework re-renders. The inline notes are mostly edge cases and trimming surface area:
- Behavior:
- the list item and nav drawer item lose their selection fade
- radio arrow-key navigation isn't a user write
- a possible gap in the combo's
igcChangehandler case
- Tests: the indeterminate and arrow-key motion tests can pass without exercising what they name.
- Styles: keep the
!important, but drop the per-component$descendantslist. - Code:
- the checkbox and radio could mark the host
- user-value bookkeeping could move from the form mixin into
value-state.ts byUserinstead of the tree'sbeforeChangehook- two names
- The nav drawer item leaves the value state rule. Its `active` is view
state, as the `selected` of a tab, so it fades as on master. It keeps
its reduced-motion wrap.
- A user mark can carry a check (`keepUserChangeWhile`); the first check
wins. The form mixin attaches it before `igcChange` when a user write
reports, else after the write, so a value that a handler sets shows at
once, also in the pickers. The registry moves to
`#internals/user-change.js`.
- The combo keeps the user change only while the list shows the
selection of the user, also after a key or the clear icon.
- Radio arrow keys write through `_writeFrom('user')`.
- The checkbox, switch and radio mark the host. The instant rule covers
the whole shadow subtree under the mark and its slotted elements. A
host waits only for the transitions of its shadow root, so a large
tree cascade no longer costs O(n2).
- Tests for the pickers, the color picker, the tree and the combo keys;
the motion tests check specific transitions. Specs record the gaps and
the precedence rule.
rkaraivanov
added a commit
that referenced
this pull request
Nov 20, 2026
…into rkaraivanov/view-state-motion - The tabs call `value-state-transitions($on-host: true)`. The rule from #2639 covers the header and its slotted icon. - `markInstant` stays in `#animations/value-state.js`, next to `addValueStateMotion` in the guidelines. - The tabs and accordion specs import `transitionsIn` and `withTheme` from `#internals/testing/motion.spec.js`.
This branch has not been deployed
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.
Description
A checkbox, switch, radio, toggle button, list item and navigation drawer item now animate only a change that the user makes, as the chip does since #2629. So does the label of an input, textarea or date input. A change from code and the first render show at once, so a virtualized list no longer animates its rows while it scrolls. In a fast scroll of 5000 rows with a checkbox, a switch and a radio, style recalc dropped from 979 ms to 187 ms.
A change that a component makes for the user also animates: the radio that a group unchecks, the toggle that a single selection deselects, the items of a tree cascade, and the options and input of a combo or select. A value that app code sets, also in an igcChange handler, shows at once. Hover, focus and the invalid state still fade.
With prefers-reduced-motion: reduce, these controls have no transitions of their own. The Material switch no longer plays its thumb keyframes.
The shared logic is in src/animations/value-state.ts, and the chip now uses it.
Type of Change
Checklist
CHANGELOG.mdentry under[Unreleased]