Skip to content

feat(tabs, nav-drawer, dialog, accordion): show the first render at once - #2640

Open
rkaraivanov wants to merge 5 commits into
masterfrom
rkaraivanov/view-state-motion
Open

rkaraivanov wants to merge 5 commits into
masterfrom
rkaraivanov/view-state-motion

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Description

Tabs no longer slide the selected indicator in or fade the selected
header in when they first render. This also applies to tabs that show
for the first time later, such as in a closed panel. A selection change
after that still animates.

A nav drawer or a dialog that is open on its first render shows at
once, with no slide and no backdrop fade. To slide in a drawer that a
framework renders open after a user action, call show(), or set open
after the first render.

Setting open on a dialog now shows the backdrop at once, as it already
did the dialog. Setting open on an expansion panel changes the
accordion spacing at once, as it already did the content. show(),
hide(), toggle() and the user still animate both.

The tabs reuse the instant mark from the value-state module, and a new
finishCSSTransitions() helper ends the other transitions.

Merged after #2639

Type of Change

  • New feature (non-breaking change that adds functionality)

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed
  • I have added a CHANGELOG.md entry under [Unreleased]

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.
Tabs no longer slide the selected indicator in or fade the selected
header in when they first render. This also applies to tabs that show
for the first time later, such as in a closed panel. A selection change
after that still animates.

A nav drawer or a dialog that is open on its first render shows at
once, with no slide and no backdrop fade. To slide in a drawer that a
framework renders open after a user action, call show(), or set open
after the first render.

Setting open on a dialog now shows the backdrop at once, as it already
did the dialog. Setting open on an expansion panel changes the
accordion spacing at once, as it already did the content. show(),
hide(), toggle() and the user still animate both.

The tabs reuse the instant mark from the value-state module, and a new
finishCSSTransitions() helper ends the other transitions.
- 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.
…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant