Repository navigation
feat(ui): add grid presentation infrastructure - #18414
Conversation
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
…infrastructure # Conflicts: # packages/ui/src/views/List/index.client.tsx
DanRibbens
left a comment
There was a problem hiding this comment.
Written by AI
Requesting changes for three regressions in the grid presentation:
- Missing thumbnails can crash the list. When a configured hasMany upload field is empty or contains only unpopulated IDs,
getThumbnailDocreturnsundefined, andDocumentGriddereferences.mimeType. These documents should render the thumbnail placeholder. - A saved grid preference breaks document selection in ListDrawers. Relationship/upload pickers inherit the collection's grid preference, but grid cards update bulk selection rather than invoking the drawer's
onSelect. Keep drawers on the table selection path until grid cards support their selection contract. - Grid navigation bypasses
admin.formatDocURL. Cards use the default document URL, ignoring both custom destinations andnullresults that disable links. Resolve these URLs on the server and preserve disabled navigation in the card.
I've opened #18529 against this PR's branch (codex/hierarchy-grid-infrastructure) with fixes and regression coverage. Please review that follow-up PR for integration here. Its 10 unit tests, 6 browser component tests, and 9 end-to-end tests passed, along with type checks, lint, and formatting. Manual visual focus and screen-reader verification remain documented there.
Written by AI ## Description Fixes the three review findings from #18414. This PR targets `codex/hierarchy-grid-infrastructure`. ## Changes - Render the thumbnail placeholder when a configured upload field is empty or contains only unpopulated IDs. - Keep relationship and upload ListDrawers on the table selection path even when the collection has a saved grid preference. - Resolve `admin.formatDocURL` on the server for flat and grouped grids, sharing URL resolution with table cells. A null result renders a title without a link and prevents double-click navigation while preserving permitted selection. - Honor `enableRowSelections` in grid cards. ## Test Plan - URL and thumbnail unit suites: 10 tests passed. - DocumentCard and DocumentGrid browser component suites: 6 tests passed. - List-view `formatDocURL` and saved-grid drawer regressions: 8 tests passed with SQLite. - WCAG 2.1.1 real rich-text relationship picker regression: 1 test passed with SQLite. - Payload/translations TypeScript builds and UI type check passed. - ESLint: no errors; existing warnings and ignored colocated specs. Prettier and `git diff --check` passed. Browser checks used locally available Chrome/Chromium executables; temporary runner configuration changes are excluded from the PR. ### Accessibility assessment Assessed missing thumbnails, linked and unlinked cards, optional selection, and the relationship picker after saving grid layout. Browser tests cover mouse activation, Enter/Space selection, disabled navigation, and selecting a real relationship with Enter. Criteria considered: 1.1.1 (thumbnail fallback), 1.3.1 and 4.1.2 (link/button semantics and selection state), 2.1.1 (keyboard operation), 2.4.3 and 2.4.4 (focus order and link purpose), 2.4.7/2.4.11 (focus visibility), 2.5.2 (pointer activation), and 3.2.1 (focus does not trigger navigation). Styling and target sizes are unchanged. Visual focus/occlusion and screen-reader announcements still need human verification. No axe or screen-reader run was performed; these checks do not establish full WCAG conformance.
DanRibbens
left a comment
There was a problem hiding this comment.
Found one little nit, not blocking. Looks good
| ) | ||
| } | ||
|
|
||
| const fields = flattenTopLevelFields(config.fields) |
There was a problem hiding this comment.
don't we have config.flattenedFields already?
There was a problem hiding this comment.
Will address in a separate PR. Requires some function call shuffling, but possible.
Requires #18414 Localizes the layout group and its Table/Grid radio labels across all supported locales, and translates the complete DocumentCard selection instructions. The translated labels are reused for accessible names and the existing hover/focus tooltips. Addressed comment from #18414 (comment)
## Summary This PR updates the upload select unit test for the Payload 4 variants contract. The test now uses `upload.variants` and verifies `select.variants`. ## Why [#18414](#18414) added the test against the former `imageSizes` and `sizes` names. [#17827](#17827) merged after that test's last successful CI run and changed the production contract to `variants`. ## Validation - The complete unit suite passes with 3,625 tests. - The React Server Component suite passes with two tests. - The audit found no other test fixtures or select assertions that use the removed contract. - Prettier and `git diff --check` pass. Written with AI
|
🚀 This is included in version v4.0.0-canary.38 |
Adds reusable grid presentation infrastructure and enables a grid view for flat collections while keeping hierarchy collections on their existing table path.
Grid presentation
Introduces reusable
CardGrid,DocumentCard,SegmentedControl, andLayoutTogglecomponents. Collections can optionally defineadmin.useAsThumbnail, with the document icon used as a fallback when no thumbnail is available.Grouped and hierarchy collections can use the same table or grid layouts while retaining their existing grouping, pagination, and navigation behavior.
Interaction and accessibility
Document cards support single-click selection, double-click navigation, keyboard selection, and a separately focusable title link for direct navigation.
Cards expose visible focus and selection states using shared design tokens. Layout controls use native radio semantics and provide “Table” and “Grid” tooltips on hover and keyboard focus.
Layout preferences and routing
The selected document layout is stored per collection as a preference and shared between the collection’s logical views.
Logical views such as
allandhierarchyare represented in theviewquery parameter, allowing browser navigation to restore the correct view without conflating it with the table or grid layout.Preference updates support functional setters to prevent rapid updates from overwriting one another, while list-query updates preserve unrelated route parameters.
Preview of navigation changes
CleanShot.2026-10-05.at.15.37.23.mp4
Preview of useAsThumbnail media card for upload collection
CleanShot.2026-10-05.at.15.43.07.mp4
Preview of useAsThumbnail media card for collection with upload field (relation)
CleanShot.2026-10-05.at.15.49.23.mp4