Repository navigation
feat(designsystem): page load line owns its motion and its end - #5172
Merged
Merged
Conversation
RaftPageLoadingBar now takes the load as a state (RaftPageLoadState: Idle, Loading(progress?), Finished, Failed) and stays composed, so it can play the approved motion itself instead of being removed by its callers: - it first shows 200ms into a load; a faster page draws no line - no progress yet: a still line at 8% (the sweep is gone from this component; RaftProgressBar keeps its own, now private to its file) - progress: forward only, each change over 200ms ease-out, up to 95% while the load still runs; "no progress" after progress is a new load and starts again from the beginning - Finished: runs to the end, then fades out over 200ms; Failed and Idle drop it at once - reduced motion: the width jumps and a finished line goes at once The life of the line is plain data (RaftPageLoadingBarLine), tested in commonTest; the delay, exit and failure are tested on the test clock in RaftPageLoadingBarUiTest. The three call sites report the web view's navigation state through raftWebPageLoadState: failed -> Failed; loading -> Loading; not loading at 100 -> Finished; not loading short of 100 (stopped, or failed before the failure callback) -> Idle, because those cannot be told apart. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Recorded by CI (test.yml record_screenshots=true, run 44774097305): the rows are now no progress (the still 8% line), 42%, and a page reporting 100% while it still loads (held at 95%). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The line showed, went and came back about 200ms later when a Settings web page's placeholder (session not known yet) gave way to the page, because each drew its own. The line now belongs to the container that swaps them: RaftWebPageLoadLineHost draws the one RaftPageLoadingBar over its content, and the placeholder and SettingsWebViewContent report their state to it (RaftWebPageLoadLine). It stays composed across the swap and goes on from where it was. Hosts: the Settings web page scaffold's body (Settings pages and Release notes), StandaloneSettingsWebViewContent, and the release notes on the App update page. A new load is now an explicit signal instead of "progress went back to none": RaftPageLoadState.Loading carries the load's name, and the web views count main-frame loads started (RaftWebViewNavigationState .loadGeneration: Android onPageStarted, iOS didStartProvisionalNavigation, desktop the loading edge). iOS reads WebKit's estimated progress at the start of a load and need not pass through 0, so the old inference could hold the line at the last load's width there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
Author
|
New failure in post-merge full tests: workflow Newly failing:
It could be any of PR 5160, PR 5162, PR 5164, PR 5165, PR 5167, PR 5168, PR 5169, PR 5170 and 14 more. Please fix. See logs: |
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
The page load line on in-app web pages (
RaftPageLoadingBar, added in #5167) gets the approved motion. Unchanged: 2dp, edge to edge, square ends, flush under the top bar,infocolour.RaftProgressBarkeeps its own;raftProgressBarSweepis now private to its file).rememberRaftReducedMotion()): the width jumps to each value, and a finished line goes at once.API
The component now owns its life, so callers keep it composed and report the load:
The life of the line is plain data (
RaftPageLoadingBarLine: Hidden / Waiting / Shown / Leaving,onState,onAppearDelayPassed,onLeft), so the rules are unit-tested without a clock; the composable only runs the 200ms timer and the two animations. Durations and fractions are named constants in the component (raft-ui has no matching tokens yet).Decisions worth a look:
RaftPageLoadingBarLoadingMaxFraction). Engines report 100% some time before the load ends; keeping the full line forFinishedmeans a full line always means done and the run to the end is always visible. The app-side cap is removed.Loading.loadnames the load, and the line starts again when it changes. The web views count main-frame loads started (RaftWebViewNavigationState.loadGeneration: AndroidonPageStarted, iOSdidStartProvisionalNavigation, desktop the not-loading to loading edge), so the rule is the same on every platform. (iOS reads WebKit's estimated progress when a load starts and need not pass through 0, so inferring it from progress could hold the line at the last load's width there.) A line that is already up stays up and snaps back; it never animates backwards.Call sites
All go through
raftWebPageLoadState(isLoading, progress, failed, loadGeneration):FailedLoading(progress, load = loadGeneration), no progress while the engine reports 0Finished(AndroidonPageFinishedand iOSdidFinishare the only places that set 100 with loading off)Idle: stopped by the user, or failed with the failure callback still to come (the engines report "not loading" first). These can't be told apart, so the line goes at onceInAppBrowserPage:failed = loadError != null.SettingsWebViewContent: fromsettingsWebViewPresentation(Errorcovers load errors, stalls and a crashed renderer).SettingsWebViewLoadingPlaceholder(session or URL not known yet):Loading()only.One line across the placeholder → page swap
The line belongs to the container that swaps the placeholder for the page, not to either of them:
RaftWebPageLoadLineHostis a Box that draws the oneRaftPageLoadingBarover its content, and the placeholder andSettingsWebViewContentonly report their state to it (RaftWebPageLoadLine; the piece that entered last speaks). The line stays composed across the swap and goes on from where it was; no timer is involved.Hosts:
SettingsWebViewPageScaffold's body (every Settings web page and Release notes, through both swaps: body-ready and session-known),StandaloneSettingsWebViewContent(when used without the scaffold) and the release notes onAppUpdatePage. A nested host defers to the outer one.SettingsWebViewContentused with no host (server setup admission, which has a plain cover and no placeholder line) draws its own line as before.Tests
RaftPageLoadingBarLineTest(commonTest): rest width, cap, forward-only, a new load named by the host, "no progress" not read as a new load, fast-load no-show, finish / fail / stop, reduced motion, a load after an ended one.RaftPageLoadingBarUiTest(desktopTest, test clock): the 200ms delay, no line for a fast load, run to the end and fade, at once on failure, reduced motion.SettingsStandaloneWebViewHostTest:raftWebPageLoadStatemapping (load generation included) and the host's combined state.SettingsWebViewStallRetryUiTest(Robolectric, test clock): lets the delay and the exit pass; new handoff test: placeholder for 500ms, then the realSettingsWebViewContentloading; the line is asserted present on every frame from the appear delay to 1.3s, then carries the page's progress.page_loading_bar_{light,dark}.pngre-recorded in CI (record_screenshots=true): rows are now no progress (8%), 42%, and a page reporting 100% (held at 95%).Docs
README row and the "Differences from raft-ui" note (a raft-design
PageLoadingLineis being added upstream to match); the 1.28.0 changeset is replaced by one describing the final behaviour (web-page-loading-line.md).Not tested
Nothing here ran on a device. The animation curve, the fade and the reduced-motion setting are only covered through the test clock and the pure model. The web views'
loadGenerationincrements have no test of their own on iOS and desktop (Android's is driven through Robolectric's WebView in the handoff test).🤖 Generated with Claude Code