Repository navigation
fix(platform): stop the board's working pulse under reduced motion - #4138
Closed
yannickmonney wants to merge 2 commits into
Closed
yannickmonney wants to merge 2 commits into
yannickmonney wants to merge 2 commits into
Conversation
The board card's "Agent is working…" glyph and the document history dialog's loading placeholder were the two `animate-pulse` uses without a reduced-motion stop; the other seven write `motion-reduce:animate-none`, `motion-safe:animate-pulse` or a `prefersReducedMotion` check. Under `prefers-reduced-motion: reduce` they still ran `pulse`, held to a single 0.01 ms iteration only by the global rule in `@tale/ui`'s stylesheet. - The working glyph takes `motion-reduce:animate-none`, as `StatusIndicator`'s pulse does; it stays visible and stops. - The history placeholder uses the shared `SKELETON_PULSE` fill. - A guard walks every non-test `.ts`/`.tsx` under `services/platform/app` and `packages/ui/src` and fails on an `animate-pulse` class with none of the three opt-outs; the turbo inputs guard and the repo contract name it as a reader of `packages/ui/src`. - The board test holds a working card to the glyph and its stop. Closes #4128
The guard let any `&&` or ternary whose condition named reduced motion through, whichever branch held the pulse, so `prefersReducedMotion ? 'animate-pulse' : …` passed while it pulses only for the people who asked for less motion. A pulse now opts out by a check only on the branch reached without the preference: the right of a `&&` chain holding `!reducedMotion`, the false branch of `reducedMotion ? … : …`, the true branch of `!reducedMotion ? … : …`.
Contributor
Author
|
Closing this unmerged. This is the fleet manager (TALE-357, run The reporter, agent #3, retracted the premise of #4128 after measuring
This PR would only add an explicit opt-out and a guard for a case that already behaves correctly. Its exact head If the team later wants a lint rule for explicit opt-outs as house style, that belongs in its own issue. |
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.
What changed
The board card's Agent is working… glyph (
task-indicators.tsx) and the document history dialog's loading placeholder were the twoanimate-pulseuses underservices/platform/appandpackages/ui/srcwithout a reduced-motion stop. The other seven writemotion-reduce:animate-none,motion-safe:animate-pulseor aprefersReducedMotioncheck.Working glyph: it gets
animate-pulse motion-reduce:animate-none, asStatusIndicator's pulse does. It keeps theBotglyph rather than swapping inStatusIndicator, which is a dot and would change the design. It stays visible and stops underprefers-reduced-motion: reduce.History dialog placeholder: it uses the shared
SKELETON_PULSEfill (@tale/ui/skeleton,animate-pulse bg-muted motion-reduce:animate-none). It looks the same as before.Guard:
services/platform/tests/guards/reduced-motion-pulse.guard.test.tsparses every non-test.ts/.tsxunderservices/platform/appandpackages/ui/srcwith the TypeScript AST. It reads each string literal as a class list and fails on ananimate-pulseclass with none of three opt-outs:motion-safe:variant;motion-reduce:animate-nonein the same class expression;&&or ternary behind a reduced-motion check, with the pulse on the branch reached only without the preference (!reducedMotion && …,reducedMotion ? … : pulse). A check the wrong way round, such asprefersReducedMotion ? 'animate-pulse' : …, is caught (eb1c83897).It carries 10 catch and 10 allow samples. It also asserts that the walk reads at least one pulse, so it can't pass vacuously.
turbo-inputs.guard.test.ts,.agents/repo.md("three suites read it as text") and the manualreference/automation.mdregister name it.Board test:
kanban-board.test.tsxrenders a card with a live run (TaskBoardProvider runningTaskIds). It checks that the working glyph is there with bothanimate-pulseandmotion-reduce:animate-none.There are no new strings and no migration. The card's prohibited
aria-labelstays with #3793.Correction to the issue's impact
@tale/ui's stylesheet already has a global reduced-motion rule (packages/ui/src/globals.css:763-773):animation-duration: 0.01ms !important; animation-iteration-count: 1 !importanton*. The platform loads it (services/platform/app/globals.css:1, imported bymain.tsx:27).The TALE-358 probe behind #4128 read only
getComputedStyle(el).animationName(k1b-board-detail.ts:57,72). That stayspulseunder the global rule. So by the stylesheet, a reduced-motion user most likely saw a single 0.01 ms iteration, not a pulse that lasts as long as the run. The issue's "pulses for minutes to hours" claim is not established; nobody has observed it in a browser either way.This PR still does what the issue asks:
nonewithout depending on that catch-all, like the seven opted-out sites and the design system's own pulses.Visual gate, pending review: no browser was allowed in this slice. Read
animation-name,animation-durationandanimation-iteration-counton the working glyph underreducedMotion: 'reduce', onmainand on this branch:mainshould readpulse,1e-05s,1;none.How I verified it
On
d39756043, with the tests written before the fix:After the fix:
bunx vitest --run --project server tests/guards/reduced-motion-pulse.guard.test.ts tests/guards/turbo-inputs.guard.test.tsgives 2 files and 56 tests passed ateb1c83897.bunx vitest --run --config vitest.ui.config.tsonkanban-board,task-indicators,task-indicators.repeatanddocument-history-dialoggives 4 files and 30 tests passed.task-modal(access, draft, limits, repeat),tasks-list, andproject-files-tab(both suites) give 7 files and 98 tests passed in jsdom. The*.browser.test.tsxsuites were not run locally; CI runs them.bunx oxlint --type-awareon the five changed TS files is clean.oxfmt --checkis clean.bun tools/lint-manual/cli.tsis ok.tscover the changed files plus the platform's ambient types gives 2,927 files and exit 0. The whole-workspacetscandbun run checkwere left to CI.Closes #4128