Repository navigation
feat(TreeList): the expand moves as one under a finger #8088
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
edcebc4
feat(TreeList): the expand moves as one under a finger
vjeux c0f5381
fix(TreeList): a guide spans its row wrapper from the top edge
vjeux c9ca58e
fix(TreeList): the changeset names the guide change for every pointer
vjeux 853b61f
docs(TreeList): records name the guide change and TreeList's own handle
vjeux f9937f1
Merge main into the TreeList expand branch (#8106 landed)
vjeux 8c7cb8b
fix(TreeList): the tree's own handle comes from useAnimatedLayout
vjeux 50fa230
docs(TreeList): DD5 reads as decided and applies under every pointer
vjeux 47024c8
test(TreeList): the expand proofs name the motion each hold judges
vjeux 4b04c01
test(TreeList): the expand proofs read the glide's own timeline
vjeux 4252b6c
Merge branch 'main' into uikit/c11-tree-expand
cixzhang 93b945e
test(TreeList): the frame-recorded expand proofs glide for 1200 ms
vjeux e1baef4
docs(TreeList): the moving clip's comment is whole sentences
vjeux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Under a coarse primary pointer, expanding a `TreeList` row glides the rows below it to their new places on the shared layout glide while its children fade in on the same timing, so the tree moves as one. A collapse fades the children out as the rows below glide up, and the chevron turns on that timing. The rows used to appear and leave in a single frame. Without an `animatedLayout` handle the motion stays inside the tree, so content after the tree takes its place at once, and the tree clips its bottom edge while it moves so no row paints over that content; pass a handle for it to glide too. The guide lines beside a group now show and hide with its rows. With reduced motion on and a finger, the children fade in where they land. With a mouse the rows still change at once. Under every pointer, a guide line now ends at the last row it joins instead of running on beside an expanded last row's children. | ||
|
|
||
| @vjeux |
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
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
|
||
| /** | ||
| * @file reducedMotion.ts | ||
| * @input The interaction harness's held animations | ||
| * @output `expectReducedMotionCrossFade`: the browser check of the Reduce | ||
| * Motion cross-fade over what a change started | ||
| * @position Test helper for the TreeList interaction specs. Each case runs | ||
| * under Reduce Motion with a coarse pointer (a finger). | ||
| */ | ||
|
|
||
| import {expect} from '@astryxdesign/a11y-spec/playwright'; | ||
| import type {HeldAnimation} from '@astryxdesign/interaction-harness'; | ||
|
|
||
| /** The limit on a touch presentation's cross-fade under Reduce Motion. */ | ||
| const REDUCED_MOTION_FADE_MS = 200; | ||
|
|
||
| const TIMING_KEYS = new Set([ | ||
| 'offset', | ||
| 'computedOffset', | ||
| 'easing', | ||
| 'composite', | ||
| ]); | ||
|
|
||
| /** Properties that move, turn or scale an element. */ | ||
| const TRAVEL = new Set(['translate', 'rotate', 'scale', 'transform']); | ||
|
|
||
| /** The properties an animation's keyframes change. */ | ||
| function animatedProperties(animation: HeldAnimation): string[] { | ||
| const properties = new Set<string>(); | ||
| for (const frame of animation.keyframes) { | ||
| for (const key of Object.keys(frame)) { | ||
| if (!TIMING_KEYS.has(key)) { | ||
| properties.add(key); | ||
| } | ||
| } | ||
| } | ||
| return [...properties]; | ||
| } | ||
|
|
||
| /** | ||
| * Whether the animation only lands `property` at a new value, rather than | ||
| * moving it through the values between. A step lands it: the value changes | ||
| * between keyframes at the same offset, or under a step easing. | ||
| */ | ||
| function onlyLands(animation: HeldAnimation, property: string): boolean { | ||
| const frames = animation.keyframes.filter(frame => property in frame); | ||
| for (let index = 0; index + 1 < frames.length; index += 1) { | ||
| const from = frames[index]; | ||
| const to = frames[index + 1]; | ||
| if (String(from[property]) === String(to[property])) { | ||
| continue; | ||
| } | ||
| const sameOffset = | ||
| Number(from.computedOffset) === Number(to.computedOffset); | ||
| const easing = typeof from.easing === 'string' ? from.easing : ''; | ||
| const stepped = /^step|steps\(/.test(easing); | ||
| if (!sameOffset && !stepped) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * The Reduce Motion cross-fade under a coarse pointer. At least one opacity | ||
| * animation runs, and its curve ends within 200 ms. Nothing travels, scales | ||
| * or resizes on the way, though an element may land at its new place in one | ||
| * step, hidden by the fade. Nothing but opacity animates. `held` is what | ||
| * `holdAnimations` returned right after the change. | ||
| */ | ||
| export function expectReducedMotionCrossFade( | ||
| held: ReadonlyArray<HeldAnimation>, | ||
| ): void { | ||
| const summary = JSON.stringify( | ||
| held.map(animation => ({ | ||
| target: animation.target, | ||
| properties: animatedProperties(animation), | ||
| curveEndMs: animation.curveEndMs, | ||
| })), | ||
| ); | ||
| let fades = 0; | ||
| for (const animation of held) { | ||
| for (const property of animatedProperties(animation)) { | ||
| if (property === 'opacity') { | ||
| fades += 1; | ||
| expect(animation.curveEndMs, summary).toBeGreaterThan(0); | ||
| expect(animation.curveEndMs, summary).toBeLessThanOrEqual( | ||
| REDUCED_MOTION_FADE_MS + 1, | ||
| ); | ||
| } else if (TRAVEL.has(property)) { | ||
| expect(onlyLands(animation, property), `${property}: ${summary}`).toBe( | ||
| true, | ||
| ); | ||
| } else { | ||
| expect(property, summary).toBe('opacity'); | ||
| } | ||
| } | ||
| } | ||
| expect(fades, summary).toBeGreaterThan(0); | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.