Skip to content

fix(ProgressBar): a determinate fill keeps moving while JavaScript runs - #8196

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c07-progressbar-compositor
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c07-progressbar-compositor

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Part of making Astryx match iOS, whose progress indicators keep moving while busy. Progress usually arrives while the page is busy, and the fill then freezes and jumps (Chromium, Safari), so the work looks stuck. Now it keeps sliding.

Problem and solution fit

The fill animated width, laid out and painted on the main thread every frame, so a busy page stalls it.

Options:

  • Keep width: the freeze stays.
  • scaleX on a full-length fill: compositor, but it stretches the round ends.
  • translateX of a full-length fill in a clipping track: compositor, round ends. Costs: a tiny fill's end follows the track's curve; a runtime direction flip sweeps the fill across.

This PR takes the third; cixzhang decided to keep it.

Expected behavior and authority

component:ProgressBar's targets are unchanged; #6248 moved the marks out of the track, so it can clip. Under Reduce Motion a new value lands at once (design:reduced-motion DEC-3).

Smallest restoration

ProgressBar.tsx: the fill transitions transform instead of width, on the theme's duration and easing; the track clips; the fill mirrors by its own direction. Forced colors keep the width geometry, so the outline stays whole (architecture:theme-tokens INV11). No API change.

Evidence

  • iOS simulator, 10 → 90 during a 0.7 s busy script; main (above) freezes at 41%, then jumps:
    The fill frozen on main and moving with this PR through the block
  • Unchanged: an ordinary change, and right to left:
    An ordinary change on main and with this PR The fill moving right to left
  • Small values, before above:
    Small values before and after

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

What I ran and what it showed:

  1. In the ProgressBar story at 10, this console line (preview frame) sets 90 and blocks the page 0.7 s: __STORYBOOK_ADDONS_CHANNEL__.emit('updateStoryArgs', {storyId: 'core-progressbar--default', updatedArgs: {value: 90}}); setTimeout(() => { const end = performance.now() + 700; while (performance.now() < end); }, 30); main freezes, then jumps; this PR keeps sliding, with no per-frame layout or paint. iOS simulator: the same (above).
  2. Chromium tests: the edge at the value in both directions, a 2% fill following the track's curve, a closed forced-colors outline, and an immediate change under Reduce Motion. The busy-page ones fail on main.
  3. Local gates at f55c39b: root build, typecheck, ESLint, Prettier, Storybook, the ProgressBar Chromium tests (19) and pnpm test:ui pass, apart from failures known elsewhere: the rich-text race test(richtext): the code block header tests wait for the copy button's tooltip #8569 fixes, and test(storybook): run the story-tree check where Storybook is built, and bring the tree back to its shape #8509 and fix(cli): a crashed run's release install is recognized by the Node it ran on, whatever its name #8520 in the node project.

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 30, 2026 11:25pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026
@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 11:49 PM UTC

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

ProgressBar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 455B 455B 0B
Lines of Code 387 411 -
Complexity High High (28) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/ProgressBar 7.8KB 7.8KB +85B 6.6KB 6.8KB +178B

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 35.6KB 35.8KB +147B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new compositor fill fixes the freeze: in Chromium the fill now reaches its new value while a 700 ms script runs, where it used to stall and then jump. Approval waits on an engineering owner deciding two visual effects that no current spec covers: the lens-shaped leading end below about one track height of fill, and the fill sweeping across the track (to about 91% for a 30% bar) when the page or region dir flips at runtime, a question design:bidirectionality OQ4 leaves open. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Separately, please fix:

  • The fill's RTL mirror keys on any RTL ancestor (:is([dir="rtl"] *) in ProgressBar.tsx), so a bar in an LTR region inside an RTL page draws its fill from the right while its label and marks stay LTR; ':dir(rtl)', which Drawer already uses, follows the nearest dir instead.
  • The Chromium RTL test sets <html dir> while the story's wrapper stays dir="ltr", so it currently asserts that nested case; setting the story's own direction would test a real RTL region.

[Automated review]

transitionProperty: 'width',
transform: {
default: 'translateX(calc(var(--_progress-bar-fill, 0%) - 100%))',
':is([dir="rtl"] *)':

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:is([dir="rtl"] *) matches whenever any ancestor is RTL, so a bar inside <div dir="ltr"> on an RTL page takes this transform. Its fill then grows from the right while its label, value text and marks stay LTR; on a 30% bar, a 20% mark is left on the bare track. design:bidirectionality DR3 requires ordered progression to follow the containing region's direction. ':dir(rtl)' resolves from the nearest dir, as Drawer.tsx already does through StyleX.

for (const dir of ['ltr', 'rtl'] as const) {
await open(page, 0);
await page.evaluate(d => {
document.documentElement.dir = d;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets <html dir>, but Storybook's decorator keeps every story inside <div dir={direction}>, which is ltr by default. The bar's region therefore stays LTR here, and the RTL assertion below pins the fill to the right of an LTR region. Setting the story's direction global (or the wrapper's dir) would test a real RTL region, and an LTR-inside-RTL case would cover the nested regression.

'@astryxdesign/core': patch
---

[fix] A determinate ProgressBar keeps moving to its new value while a script runs. The fill animated its `width`, which lays out and repaints on the main thread every frame, so a value change stalled for as long as the page ran JavaScript and then jumped. The fill now spans the track and slides into place with a transform that the browser animates on its compositor, in Chromium and in Safari, laying out and painting nothing per frame. Duration, easing, colors, marks and RTL are unchanged; the track now clips its fill to the rounded rail in both modes, so below about one track height of fill the leading end follows the track's curve.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"RTL are unchanged" does not hold for an LTR region inside an RTL page, where the fill is now drawn from the right, or for a runtime dir flip, where the fill now animates across the track. Please correct it once those are settled.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compositor fill fixes the freeze: in Chromium the fill now keeps moving to its new value while a 700 ms script runs, where it used to stall and then jump. Approval waits on an engineering owner deciding two visual effects that no current spec covers, the lens-shaped leading end below about one track height of fill and the fill sweeping across the track (to about 91% for a 30% bar) when the page or region dir flips at runtime, which design:bidirectionality OQ4 leaves open; an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Independently of that decision:

  • ProgressBar.tsx:250 keys the fill's mirror on any RTL ancestor (:is([dir="rtl"] *)), so a bar in an LTR region inside an RTL page fills from the right; ':dir(rtl)', which Drawer already uses, follows the nearest dir.
  • The Chromium RTL test sets <html dir> while Storybook keeps the story in <div dir="ltr">, so it asserts that nested case; give it a real RTL region and an LTR-inside-RTL case.
  • The Changeset says RTL is unchanged and names only the new small-value shape; please correct it once the owner has ruled.
  • The red pr-a11y job comes from a step main added for a lab spec this branch does not have yet, and your new ProgressBar step passes there, so a rebase onto main clears it.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compositor fill fixes the freeze: in Chromium the fill now keeps moving to its new value while a 700 ms script runs, and the mirror now follows the bar's own direction, so LTR regions inside RTL pages fill from the left. Approval waits on an engineering owner deciding three consequences that no current spec settles: the lens-shaped leading end below about one track height of fill, the fill sweeping across the track when the page or region dir flips at runtime (design:bidirectionality OQ4 leaves this open), and new values landing at once on every pointer under reduced motion, where design:reduced-motion DR2 asks a coarse pointer to cross-fade if determinate progress is in its scope. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Independently of that decision:

  • The Changeset should name the old small-value shape (a narrow full-height capsule) beside the new one and mention the animated direction flip, as spec:AST-017 FR3 asks.
  • The size report needs the base and head gzip size of the @astryxdesign/core package stylesheet, which spec:AST-080 FR8 requires beside the component figures.

[Automated review]

'@astryxdesign/core': patch
---

[fix] A determinate ProgressBar keeps moving to its new value while a script runs. The fill animated its `width`, which lays out and repaints on the main thread every frame, so a value change stalled for as long as the page ran JavaScript and then jumped. The fill now spans the track and slides into place with a transform that the browser animates on its compositor, in Chromium and in Safari, laying out and painting nothing per frame. Under reduced motion a new value now lands at once, on every pointer. Otherwise duration, easing, colors, marks and right-to-left drawing are unchanged (the fill mirrors with the bar's own direction, so a bar in a left-to-right region of a right-to-left page still fills from the left); the track now clips its fill to the rounded rail in both modes, so below about one track height of fill the leading end follows the track's curve.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This names the new small-value end ("follows the track's curve") but not the old one, a narrow full-height capsule, and says right-to-left drawing is unchanged without mentioning that a runtime dir flip now sweeps the fill across the track. spec:AST-017 FR3 asks a visual change's Changeset to name the old and new appearance; once an engineering owner rules on the shape, FR3 also decides between [fix] and [feat].

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compositor fill fixes the freeze: in Chromium the fill now keeps moving to its new value while a 700 ms script runs, where it used to stall and then jump. Approval waits on an engineering owner deciding three consequences that no current spec settles: the lens-shaped leading end below about one track height of fill, the fill sweeping across the track when the page or region dir flips at runtime (design:bidirectionality OQ4 leaves this open), and new values landing at once on every pointer under reduced motion, where design:reduced-motion DR2 asks a coarse pointer to cross-fade if determinate progress is in its scope. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Independently of that decision, the size report needs this head's figures: astryx.css is now 34,300 B gzip (+90 B), not the reported 34,254 B (+44 B), because the last commit's two reduced-motion keys add 46 B, so please update it and ProgressBar's CSS delta, or return to the single (prefers-reduced-motion: reduce) key, which behaves the same.

[Automated review]

Comment on lines +260 to +267
// The keys are the shared reduced-motion queries, a fine pointer's and a
// coarse pointer's, spelled as the record's other transitions spell them.
transitionDuration: {
default: durationVars['--duration-medium'],
'@media (prefers-reduced-motion: reduce) and (not (pointer: coarse))':
'0s',
'@media (prefers-reduced-motion: reduce) and (pointer: coarse)': '0s',
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two keys together match every pointer, exactly like the single (prefers-reduced-motion: reduce) key they replace, so behaviour is unchanged (Chromium applies 0s with a mouse and with a finger). StyleX makes the first key exclusive of the second, so the package stylesheet carries @media ((prefers-reduced-motion: reduce) and (not (pointer: coarse)) and (not (prefers-reduced-motion: reduce))) or ((prefers-reduced-motion: reduce) and (not (pointer: coarse)) and (not (pointer: coarse))), and astryx.css grows from 34,254 B to 34,300 B gzip; the size line in the description still shows 34,254 B, and spec:AST-080 FR8 needs this head's figure. No other module spells either query yet, so the comment's "spelled as the record's other transitions spell them" describes a convention the repository does not have; the single key would keep both the CSS and the comment simpler.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
This PR's base: the determinate fill on the compositor (meta#8196) and the touch foundation (meta#8076).

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compositor fill fixes the freeze: in Chromium the fill now keeps moving to its new value while a 700 ms script runs, where it used to stall and then jump. Approval waits on an engineering owner deciding three consequences that no current spec settles: the lens-shaped leading end below about one track height of fill, the fill sweeping across the track when the bar's direction flips at runtime (design:bidirectionality OQ4 leaves this open), and new values landing at once on every pointer under reduced motion, where design:reduced-motion DR2 asks a coarse pointer to cross-fade if determinate progress is in its scope. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Independently of that decision, please keep the fill's forced-colors boundary whole: the track's new clip cuts its start cap on every partly filled bar (only a ) arc is left at 2%), which architecture:theme-tokens INV11 rules out, and giving the fill its old width geometry under forced-colors: active closes it.

[Automated review]

// The indeterminate fill overshoots the track on both sides and must be
// clipped to the visible rail. Marks are suppressed in this mode.
trackClipped: {
overflow: 'hidden',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the fill spanning the track and translated back, this clip also cuts the fill's forced-colors CanvasText outline (lines 250-258): in forced colors every bar filled between 0% and 100% loses the outline's start cap, and at 2% only the leading ) arc is left, where main draws a closed capsule. architecture:theme-tokens INV11 asks a status fill to keep a visible CanvasText border "so its shape survives". Giving the fill its old geometry under @media (forced-colors: active) (width: var(--_progress-bar-fill, 0%), transform: none, transition on width) closes it; the jsdom forced-colors check passes either way, so a Chromium assertion on the rendered boundary would hold it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in de43cd2. Under forced-colors: active the fill is sized to the value again (width: var(--_progress-bar-fill, 0%), transform: none, a width transition), so its CanvasText outline is a closed capsule inside the track; elsewhere it still moves on the compositor. A Chromium test emulates forced colors and checks, at 2% and 50% in LTR and RTL, that the fill sits inside the track at the value and that the outline's color is drawn at the track's inline-start edge. It fails against the slid fill, whose box started 362.6 px before the track.

@vjeux

vjeux commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Approval here waits on an engineering owner's decision on three consequences of moving the fill by transform, which no current record settles:

  1. Below about one track height of fill (2% of a 370 px bar), the leading end follows the track's curve, a lens, instead of a narrower capsule. The description's small-values image shows both.
  2. When the bar's direction flips at runtime, the fill sweeps across the track to its new side over the theme's duration, where a fill sized by width jumped there. design:bidirectionality OQ4 leaves runtime direction changes open.
  3. Under reduced motion a new value lands at once on every pointer. If determinate progress counts as a design:reduced-motion DR1 transition, DR2 asks a coarse pointer for an opacity cross-fade of 200 ms or less instead. The same question for the touch timing is open on feat(ProgressBar): UIProgressView's timing under a finger #8225.

Should the record take these as they are, or ask for a change to any of them?

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
The base: the determinate fill on the compositor (meta#8196, now keeping its forced-colors outline) and the touch foundation (meta#8076).
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
Under forced colors the determinate fill is sized to the value again, so the
track's clip never cuts its CanvasText outline. With a finger it keeps this
PR's touch minimum (two track heights above zero) and its flip offset in that
width; the touch transform's key sits before the forced-colors key, so StyleX
negates it there. A Chromium test emulates forced colors under a finger and
checks the sized fill at 1% and 50% in LTR and RTL. The unit test reads the
touch transform from the source: under the negated condition the jsdom runtime
injects only part of it. The reduced-motion comment says only what holds.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
The base: the determinate fill on the compositor (meta#8196 de43cd2) and the touch foundation (meta#8076, with main and the meta#8348 harness).

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compositor fill fixes the freeze: in Chromium the fill now keeps moving to its new value while a 700 ms script runs, and in forced colors its outline is a closed capsule again. Approval waits on an engineering owner deciding three consequences that no current spec settles: the lens-shaped leading end below about one track height of fill, the fill sweeping across the track when the bar's direction flips at runtime (design:bidirectionality OQ4 leaves this open), and new values landing at once on every pointer under reduced motion, where design:reduced-motion DR2 asks a coarse pointer to cross-fade if determinate progress is in its scope. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Nothing else needs to change before then.

[Automated review]

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
The base: the determinate fill on the compositor (meta#8196 de43cd2) and the touch foundation (meta#8076, re-folded onto main).
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
The base: the determinate fill on the compositor (meta#8196 de43cd2) and the touch foundation (meta#8076, re-folded onto main with meta#8521).
@cixzhang

cixzhang commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Posted by Cindy's agent on her behalf.

Thanks for moving the fill onto a compositor animation. Cindy's decision: keep this transform animation for the determinate fill, with the fill clipped to the rounded track, so its ends stay round at every value and a small value never shows a flattened sliver. This PR already does that, and under Reduce Motion a new value lands at once on every pointer, matching her separate Reduce Motion decision. No changes needed for the decision.

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec de43cd2

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
The base: the determinate fill on the compositor (meta#8196 de43cd2) and the touch foundation (meta#8076, with main through meta#8663).
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec de43cd2

@vjeux
vjeux marked this pull request as draft October 29, 2026 22:33
A determinate fill's value change ran as a width transition, which the browser lays out and repaints on the main thread every frame, so it stopped while a script ran and then jumped to the new value. The fill now spans the whole track, clipped to the rounded rail, and slides along it by transform, so the change runs on the compositor, timed by the theme's duration and easing as before. Under forced colors it is still sized by its width.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ready to approve: the ProgressBar fill now keeps moving to its new value while the page runs JavaScript, a new value lands at once under reduced motion as design:reduced-motion asks, forced colors keep a closed outline, and the small-value end and animated direction flip match the engineering owner's recorded decision. The new Chromium spec passes on this head and fails against the base, so it guards the fix. CI has not run on this head because the pull request is still a draft; mark it ready for review so the required checks run before merging.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 02:21
@cixzhang
cixzhang merged commit 0d67f0f into meta:main Oct 31, 2026
100 checks passed
@vjeux
vjeux deleted the uikit/c07-progressbar-compositor branch October 31, 2026 02:57

This branch was successfully deployed

1 active deployment
Preview — f55c39b8 Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants