[6.x] Fix widgets not rendering at their configured width - #15305
Open
jasonvarga wants to merge 4 commits into
Open
[6.x] Fix widgets not rendering at their configured width#15305jasonvarga wants to merge 4 commits into
jasonvarga wants to merge 4 commits into
Conversation
Move the width table out of publish.css into its own stylesheet, and let it accept spans of 1-12 alongside the existing percentages and size keywords. Every value maps to a span of the same twelve column grid the publish form already uses. The percentages were always exact twelfths, so nothing that renders today changes. The rules are now unconditional, with the container query that collapses everything to a single column moved onto the grid itself. That leaves each grid free to pick its own collapse point while sharing one width vocabulary. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Widgets each had their own four step responsive ramp, so two widgets set to 50 rendered a third wide at large viewports and never sat side by side. Replace the ramp with the same twelve column grid the publish form uses, and one container query for the whole dashboard. The threshold stays at 672px, where widgets already went from full to half width, so the point at which they first pair up is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Emit the configured width as a class and let the stylesheet resolve it, matching what ui/Publish/Fields.vue already does. Without this a width of 6 would mean half a dashboard but a full width field, silently, because .field-w-6 didn't exist and the grid fell back to a full row. The width selector compares on resolved spans, so a hand written span still fills the right number of stops and reads back as a percentage rather than as itself. Clicking a stop still writes the stop's own value. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
field_width_class(), tailwind_width_class() and Str::tailwindWidthClass() are all uncalled by core now that the stylesheet resolves widths. The two JS ones are public API regardless of who imports them, because index.js spreads every named export of globals.js onto window, so freeze all three as they are rather than teaching them about spans. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Two dashboard widgets set to
50don't sit side by side at wide viewports — they render a third wide, leaving a third of the row empty. Widths have been a hint rather than a contract.Widgets each had their own four-step responsive ramp (
sm/md/lg/full), which folded the six original percentages into four buckets, so25and33both becamesm, and50and66both becamemd. Fields, meanwhile, already resolve their width to a span of a twelve column grid.This drops the ramps and puts widgets on that same grid, with a single container query at 672px deciding whether the configured arrangement applies or everything stacks in order. 672px is where widgets already went from full to half width, so the point at which they first pair up is unchanged.
The width vocabulary is now shared by fields and widgets, and understands column spans of
1–12alongside the percentages it already accepted. The percentages were always exact twelfths (25→ 3,33→ 4,50→ 6,66→ 8,75→ 9,100→ 12), so everything that renders today renders identically. Thesm/md/lg/fullkeywords stay widgets-only. Accepting spans on both surfaces at once matters: if only widgets took them,width: 6would mean half a dashboard but a full width field.The blueprint builder's width selector now fills and labels itself on resolved spans, so a hand-written
width: 6shows as half-filled and reads50%rather than6%.field_width_class(),tailwind_width_class()andStr::tailwindWidthClass()are all uncalled by core now. They're deprecated but frozen exactly as they are — the two JS ones are public API regardless of who imports them, since every named export ofglobals.jsis assigned ontowindow.Upgrading
A blueprint or widget configured with
width: 1throughwidth: 12renders full width today and will now render as that many columns. This is only reachable if you'd typed a value that was never valid.