Repository navigation
UI: Scale Spinner stroke width with its size - #85378
Conversation
Use a 24-unit viewBox with a 1.5-unit stroke, the same proportions as the icon library, and let SVG scaling set the rendered stroke width instead of keeping a fixed 2px non-scaling stroke.
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: -126 B (0%) Total Size: 9.07 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Custom Completer: should allow newlines after multiple option completions in
|
|
I'll ultimately defer to @jameskoster and @ciampo on this, what works for the present state for icon scaling. But I'd like to revisit how we treat stroke width scaling above a certain size, I think there are aspects to the themeability that we can explore in the future. |
|
This is a bit tricky because if the principle is that the stroke-weight should make the spinner feel like part of the text adjacent, then in the button context this feels a little off because button label has emphasised weight. The spinner feels light in comparison. But next to body text this feels right. Would it be too much to have an option for emphasised spinner stroke weight for these cases? Or perhaps that's just something the button should override. |
That's one of the things I was alluding to. I'd love to explore scaling the stroke-width according to the font-weight. So if you had a 60px font size at font-weight 100 (e.g. very thin), so would the stroke-width be thin, even if it was large. |
Match the emphasized label weight with a 1.5x stroke, set from the Button stylesheet so the Spinner default stays unchanged.
|
I've appended new screenshots to the description that show the button spinners adjusted ad hoc to a heavier weight that I thought looked ok. For now I think the ad hoc weight is fine. If we find ourselves wanting this a lot, I'm thinking we could perhaps have Sound good? |
ciampo
left a comment
There was a problem hiding this comment.
LGTM code-wise, altohough it will need a design blessing ✨
|
I'm going to merge this to unblock the rest of the fix that I want to get into 7.2. Design team, we can tweak the design details at any time. |
* UI: Scale Spinner stroke width with its size Use a 24-unit viewBox with a 1.5-unit stroke, the same proportions as the icon library, and let SVG scaling set the rendered stroke width instead of keeping a fixed 2px non-scaling stroke. * Link Spinner changelog entry * Describe Spinner stroke change without exact sizes * Use a heavier spinner stroke in Button Match the emphasized label weight with a 1.5x stroke, set from the Button stylesheet so the Spinner default stays unchanged. * Bring the Button spinner stroke closer to 1.5px * Drop Button from the Spinner changelog entry Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.2 branch to get it included in the next release: e93004f |
| /* Heavier than the Spinner default to match the emphasized label weight. */ | ||
| > * { | ||
| stroke-width: 2.75; | ||
| } |
There was a problem hiding this comment.
Minor, and pre-existing: This kind of * descendent targeting seems to be the same kind of external extension we try to discourage in downstream consumers (i.e. we're not "practicing what we preach"). Maybe it's more tolerable if we're the ones doing it, but at least one practical effect is that it implicitly ties these styles to the internal structure of the Spinner implementation. Not strictly necessary, but a small improvement we could do is apply properties on .spinner and rely on inheritence, which stroke-width (and stroke below) would.
This updates the pinned commit hash of the Gutenberg repository from `be6a50be6834e922b9db12c75c9a2cd817b2db59` to `d72020a651eda64dcc53b5dbd5b9d5bd511c4cc9` (version 24.3.0-rc.1). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@be6a50b...d72020a - BorderControl: Remove double focus outline (WordPress/gutenberg#85173) - Snackbar: Use design system focus ring (WordPress/gutenberg#85168) - SelectControl: Fix default options showing the `Select` placeholder (WordPress/gutenberg#85172) - Actions API: Remove the unsupported `single` action context (WordPress/gutenberg#85186) - Client-side media: Upgrade wasm-vips to 0.0.19 and raise memory budgets accordingly (WordPress/gutenberg#84980) - Styles: Fix inconsistent 'Elements' tools panel heading level (WordPress/gutenberg#85247) - `media-utils`/MediaEdit: use design system focus ring (WordPress/gutenberg#84940) - Icons: Add new form based icons. (WordPress/gutenberg#84074) (WordPress/gutenberg#85360) - Navigation: keep custom CSS off inner list containers (WordPress/gutenberg#84881) (WordPress/gutenberg#85367) - Navigation: keep Global Styles custom CSS off inner list containers (WordPress/gutenberg#85366) - Edit as HTML: Show design system focus ring on the HTML textarea (WordPress/gutenberg#85266) (WordPress/gutenberg#85359) - Icons: Restore the missing speech bubble in postComments (WordPress/gutenberg#85275) - Block Directory: Standardize downloadable block focus indicators (WordPress/gutenberg#85307) - Global Styles: Add icons and tweak styling for element and block buttons (WordPress/gutenberg#85363) (WordPress/gutenberg#85414) - Tests: Stop asserting Core lacks the core fields functions (WordPress/gutenberg#85201) - Meta Boxes: Use the design system focus ring for the panel toggle (WordPress/gutenberg#85355) (WordPress/gutenberg#85410) - DataViews: Use the design system focus ring for list items. (WordPress/gutenberg#85358) (WordPress/gutenberg#85435) - Components: Standardize checkbox and radio focus outlines (WordPress/gutenberg#85379) (WordPress/gutenberg#85436) - UI: Use solid brand highlights for popup items (WordPress/gutenberg#84087) - Media: Preserve EXIF metadata when converting HEIC to JPEG client-side (WordPress/gutenberg#82040) - Icons: Add error, info and postComments to the core-admin collection (WordPress/gutenberg#85452) - UnitControl: Use the design system outline for the unit select focus ring (WordPress/gutenberg#85444) - Page List: Keep pages visible in the Navigation sidebar in contentOnly (WordPress/gutenberg#85357) - Icons: Add new asterisk icon (WordPress/gutenberg#85442) (WordPress/gutenberg#85498) - wp-env: Keep Debian security updates in Bullseye-based images (WordPress/gutenberg#85469) - Editor: Guard entity preload filters and share entity actions/fields logic (WordPress/gutenberg#85390) (WordPress/gutenberg#85499) - UI: Scale Spinner stroke width with its size (WordPress/gutenberg#85378) - [WP 7.2] Fix the block-library TypeScript test project (WordPress/gutenberg#85533) - Editor: Vertically center the Categories loading spinner (WordPress/gutenberg#85563) - DataViews: Render table bulk actions outside the table (WordPress/gutenberg#85250) (WordPress/gutenberg#85571) - Record e2e traces only when a failed test is retried (WordPress/gutenberg#85428) - Writing flow: fix triple click in a list item selecting the next item (WordPress/gutenberg#85569) - Build: Limit concurrent wp-build builds (WordPress/gutenberg#79889) - Icons: Promote Dashicon replacements to `core-admin` and map their Dashicons (WordPress/gutenberg#85541) Props peterwilsoncc, mamaduka. See #66340 git-svn-id: https://develop.svn.wordpress.org/trunk@64796 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned commit hash of the Gutenberg repository from `be6a50be6834e922b9db12c75c9a2cd817b2db59` to `d72020a651eda64dcc53b5dbd5b9d5bd511c4cc9` (version 24.3.0-rc.1). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@be6a50b...d72020a - BorderControl: Remove double focus outline (WordPress/gutenberg#85173) - Snackbar: Use design system focus ring (WordPress/gutenberg#85168) - SelectControl: Fix default options showing the `Select` placeholder (WordPress/gutenberg#85172) - Actions API: Remove the unsupported `single` action context (WordPress/gutenberg#85186) - Client-side media: Upgrade wasm-vips to 0.0.19 and raise memory budgets accordingly (WordPress/gutenberg#84980) - Styles: Fix inconsistent 'Elements' tools panel heading level (WordPress/gutenberg#85247) - `media-utils`/MediaEdit: use design system focus ring (WordPress/gutenberg#84940) - Icons: Add new form based icons. (WordPress/gutenberg#84074) (WordPress/gutenberg#85360) - Navigation: keep custom CSS off inner list containers (WordPress/gutenberg#84881) (WordPress/gutenberg#85367) - Navigation: keep Global Styles custom CSS off inner list containers (WordPress/gutenberg#85366) - Edit as HTML: Show design system focus ring on the HTML textarea (WordPress/gutenberg#85266) (WordPress/gutenberg#85359) - Icons: Restore the missing speech bubble in postComments (WordPress/gutenberg#85275) - Block Directory: Standardize downloadable block focus indicators (WordPress/gutenberg#85307) - Global Styles: Add icons and tweak styling for element and block buttons (WordPress/gutenberg#85363) (WordPress/gutenberg#85414) - Tests: Stop asserting Core lacks the core fields functions (WordPress/gutenberg#85201) - Meta Boxes: Use the design system focus ring for the panel toggle (WordPress/gutenberg#85355) (WordPress/gutenberg#85410) - DataViews: Use the design system focus ring for list items. (WordPress/gutenberg#85358) (WordPress/gutenberg#85435) - Components: Standardize checkbox and radio focus outlines (WordPress/gutenberg#85379) (WordPress/gutenberg#85436) - UI: Use solid brand highlights for popup items (WordPress/gutenberg#84087) - Media: Preserve EXIF metadata when converting HEIC to JPEG client-side (WordPress/gutenberg#82040) - Icons: Add error, info and postComments to the core-admin collection (WordPress/gutenberg#85452) - UnitControl: Use the design system outline for the unit select focus ring (WordPress/gutenberg#85444) - Page List: Keep pages visible in the Navigation sidebar in contentOnly (WordPress/gutenberg#85357) - Icons: Add new asterisk icon (WordPress/gutenberg#85442) (WordPress/gutenberg#85498) - wp-env: Keep Debian security updates in Bullseye-based images (WordPress/gutenberg#85469) - Editor: Guard entity preload filters and share entity actions/fields logic (WordPress/gutenberg#85390) (WordPress/gutenberg#85499) - UI: Scale Spinner stroke width with its size (WordPress/gutenberg#85378) - [WP 7.2] Fix the block-library TypeScript test project (WordPress/gutenberg#85533) - Editor: Vertically center the Categories loading spinner (WordPress/gutenberg#85563) - DataViews: Render table bulk actions outside the table (WordPress/gutenberg#85250) (WordPress/gutenberg#85571) - Record e2e traces only when a failed test is retried (WordPress/gutenberg#85428) - Writing flow: fix triple click in a list item selecting the next item (WordPress/gutenberg#85569) - Build: Limit concurrent wp-build builds (WordPress/gutenberg#79889) - Icons: Promote Dashicon replacements to `core-admin` and map their Dashicons (WordPress/gutenberg#85541) Props peterwilsoncc, mamaduka. See #66340 Built from https://develop.svn.wordpress.org/trunk@64796 git-svn-id: http://core.svn.wordpress.org/trunk@63946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the pinned commit hash of the Gutenberg repository from `be6a50be6834e922b9db12c75c9a2cd817b2db59` to `d72020a651eda64dcc53b5dbd5b9d5bd511c4cc9` (version 24.3.0-rc.1). A full list of changes included in this commit can be found on GitHub: WordPress/gutenberg@be6a50b...d72020a - BorderControl: Remove double focus outline (WordPress/gutenberg#85173) - Snackbar: Use design system focus ring (WordPress/gutenberg#85168) - SelectControl: Fix default options showing the `Select` placeholder (WordPress/gutenberg#85172) - Actions API: Remove the unsupported `single` action context (WordPress/gutenberg#85186) - Client-side media: Upgrade wasm-vips to 0.0.19 and raise memory budgets accordingly (WordPress/gutenberg#84980) - Styles: Fix inconsistent 'Elements' tools panel heading level (WordPress/gutenberg#85247) - `media-utils`/MediaEdit: use design system focus ring (WordPress/gutenberg#84940) - Icons: Add new form based icons. (WordPress/gutenberg#84074) (WordPress/gutenberg#85360) - Navigation: keep custom CSS off inner list containers (WordPress/gutenberg#84881) (WordPress/gutenberg#85367) - Navigation: keep Global Styles custom CSS off inner list containers (WordPress/gutenberg#85366) - Edit as HTML: Show design system focus ring on the HTML textarea (WordPress/gutenberg#85266) (WordPress/gutenberg#85359) - Icons: Restore the missing speech bubble in postComments (WordPress/gutenberg#85275) - Block Directory: Standardize downloadable block focus indicators (WordPress/gutenberg#85307) - Global Styles: Add icons and tweak styling for element and block buttons (WordPress/gutenberg#85363) (WordPress/gutenberg#85414) - Tests: Stop asserting Core lacks the core fields functions (WordPress/gutenberg#85201) - Meta Boxes: Use the design system focus ring for the panel toggle (WordPress/gutenberg#85355) (WordPress/gutenberg#85410) - DataViews: Use the design system focus ring for list items. (WordPress/gutenberg#85358) (WordPress/gutenberg#85435) - Components: Standardize checkbox and radio focus outlines (WordPress/gutenberg#85379) (WordPress/gutenberg#85436) - UI: Use solid brand highlights for popup items (WordPress/gutenberg#84087) - Media: Preserve EXIF metadata when converting HEIC to JPEG client-side (WordPress/gutenberg#82040) - Icons: Add error, info and postComments to the core-admin collection (WordPress/gutenberg#85452) - UnitControl: Use the design system outline for the unit select focus ring (WordPress/gutenberg#85444) - Page List: Keep pages visible in the Navigation sidebar in contentOnly (WordPress/gutenberg#85357) - Icons: Add new asterisk icon (WordPress/gutenberg#85442) (WordPress/gutenberg#85498) - wp-env: Keep Debian security updates in Bullseye-based images (WordPress/gutenberg#85469) - Editor: Guard entity preload filters and share entity actions/fields logic (WordPress/gutenberg#85390) (WordPress/gutenberg#85499) - UI: Scale Spinner stroke width with its size (WordPress/gutenberg#85378) - [WP 7.2] Fix the block-library TypeScript test project (WordPress/gutenberg#85533) - Editor: Vertically center the Categories loading spinner (WordPress/gutenberg#85563) - DataViews: Render table bulk actions outside the table (WordPress/gutenberg#85250) (WordPress/gutenberg#85571) - Record e2e traces only when a failed test is retried (WordPress/gutenberg#85428) - Writing flow: fix triple click in a list item selecting the next item (WordPress/gutenberg#85569) - Build: Limit concurrent wp-build builds (WordPress/gutenberg#79889) - Icons: Promote Dashicon replacements to `core-admin` and map their Dashicons (WordPress/gutenberg#85541) Props peterwilsoncc, mamaduka. See #66340 git-svn-id: https://develop.svn.wordpress.org/trunk@64796 602fd350-edb4-49c9-b593-d223f7449a82
What?
Follow-up to the discussion in #84633.
Scale the
@wordpress/uiSpinnerstroke width with the spinner's rendered size, using the same proportions as the WordPress icons.Why?
In the discussion on #84633, the small spinner looked heavy next to the thin plus and check icons.
Spinnercurrently uses a 2px non-scaling stroke at every size, while icons draw a 1.5-unit stroke in a 24×24 viewBox and scale with their size. The suggestion there was for inline spinners to follow the same rules as icons.How?
Use a 24×24 viewBox with a 1.5-unit stroke and remove
vector-effect: non-scaling-stroke, so SVG scaling sets the rendered stroke width. The arc keeps its current geometry, a half-circle whose centerline sits on the edge of the box, so the shape, centering, overflow, and rotation are unchanged. Removingnon-scaling-strokefrom the previous 100×100 geometry alone would have given a stroke of 0.32px at 16px.The rendered stroke is now the spinner size divided by 16:
The default 16px spinner is thinner.
Buttonloading spinners, sized to the button font size, go from 2px to about 1.49px at 13px. The validating spinner in form fields goes from 2px to 0.75px at 12px. Sizes above 32px are thicker than before. The color, forced-colors stroke, animation,roleandfocusableattributes, and sizing API are unchanged.Buttonsets a heavier 2.75-unit stroke on its spinner, so the spinner matches the emphasized label weight. At the 13px button font size, this renders at about 1.49px, close to the 1.5px stroke that 24px icons have. The override lives in theButtonstylesheet, in thecompositionslayer, so theSpinnerdefault is unchanged. Without it, theButtonspinner would be about 0.81px at 13px.Testing Instructions
Screenshots or screencast
Buttonloading spinnerThe
Buttonrow in the table above predates the heavierButtonstroke. Before uses the default 1.5-unit stroke, and after uses the 2.75-unitButtonstroke. Idle labels are shown above the loading states for weight comparison, with a standalone 13pxSpinnernext to body text.