[WC-3505]: Gallery pagination design properties are not applied - #2388
[WC-3505]: Gallery pagination design properties are not applied#2388yordan-st wants to merge 11 commits into
Conversation
267ca2a to
b97098c
Compare
iobuhov
left a comment
There was a problem hiding this comment.
One of the biggest changes I need is to replace word "zone" with "slot". Slot is more known term in frontend to denote areas where you can put your elements.
Please rewrite spec, comments, variables and other identifiers. Word "zone" is bit too alien.
bd1edd0 to
8060d99
Compare
AI Code Review
What was reviewed
CI: code quality check ✅, sigridci ✅, E2E (1) ✅, Snyk ✅ — release build and E2E (0) still in progress at review time. Skipped (out of scope): Findings🔶 Medium —
|
Pull request type
Bug fix (non-breaking change which fixes an issue)
Description
Gallery's
Paginationdesign property (Left / Center) has done nothing since the pagination overhaul. Its CSS keyed off a.widget-gallery-paginationwrapper that the overhaul deleted, so pagination was always right-aligned regardless of the setting.Restoring it is not a CSS change. Pagination now lives in a three-zone flex bar (
*-start/*-middle/*-end) where the zone, not the bar, decides position, and those zones are already used by the selection counter and the load more button. Overridingjustify-contentinside the end zone would centre pagination at ~83% of the bar width, and doing it with CSSorderor grid placement would reorder visually while leaving DOM order fixed — a WCAG 2.4.3 (Focus Order) and 1.3.2 (Meaningful Sequence) defect for a paging control.So placement is decided in markup by a pure function,
resolveZones:*-start*-middle*-middle*-start*-endThe rule is total: at most three occupants, three zones, and custom pagination replaces the built-in bar rather than adding to it, so at most one occupant is ever displaced. Displacement was chosen over wrapping to a second row because the counter appears dynamically at
selected > 0— wrapping would shift the page the moment a user selects their first item.The same result drives the footer, the top bar and the editor preview, so they cannot drift apart. That drift is what produced the second and third fixes below.
Also fixed here
Position of paginationat runtime — it always rendered below the gallery.Above gridnow renders it in the top bar.Bothrenders it once in the footer, because awidgetsplaceholder rendered twice would duplicate widget instances, DOM ids and state;check()now surfaces a warning explaining that.Design property changes (
data-widgets)Paginationis now a toggle button group with Atlas align icons, matching every other alignment control in Studio Pro, and gains an explicitRightoption.CE6083andCE6087in every existing app until a developer runs "Update all renamed design properties in project". Verified in Studio Pro during development..widget-gallery-paginationrules removed;fc-middle/tb-middleare now real flex zones so Center is centred by construction rather than incidentally.Accessibility note, intended: DOM order stays start → middle → end, so alignment now also determines tab and reading order —
Leftputs the paging controls before the Clear selection button. Visual and focus order stay in agreement, which the CSS-only alternatives could not achieve.Not in this PR: DataGrid 2's
-padding-topcontainer-query typo and its identical custom-pagination position bug ship separately so Gallery and DataGrid 2 changes stay reviewable apart. [WC-3547 Data Grid 2: Stack top bar in narrow containers](#2389 (comment))Tests: 145 unit tests pass (was 131).
resolveZonesis covered by an exhaustive 24-combination invariant pass; the bar components are asserted against real rendered DOM per zone.Planning artifacts:
packages/pluggableWidgets/gallery-web/openspec/changes/fix-gallery-pagination-placement/.What should be covered while testing?
Build both packages into a test project:
Pagination= Paging buttons. For each of Left / Center / Right, checkPosition of pagination= Below grid, Above grid, Both. Pagination should sit hard left, truly centred on the bar, or hard right, in both bars.Show selection count= Bottom. Select an item. With Left, pagination takes the left slot and the count moves right; with Center, the count stays left. Repeat withShow selection count= Top against the top bar.Pagination= Load more,Show total counton, selection active. Center should give: count left, paging status centred, Load more right.Above grid(renders in the top bar),Below grid(footer),Both(footer only, plus a warning on the widget in Studio Pro). Confirm alignment moves the custom widgets too.