feat(table): use container queries#8054
Conversation
WalkthroughAdds root-level container declarations and converts Table component responsive breakpoints from viewport media queries to container queries; updates documentation and adds a demo showing container-scoped responsive behavior for tables and a drawer. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preview: https://pf-pr-8054.surge.sh A11y report: https://pf-pr-8054-a11y.surge.sh |
- Add container-type and container-name to root element - Convert table grid media queries to container queries - Enable responsive table behavior based on container size Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
f700ace to
fe0f821
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/patternfly/components/Table/table-grid.scss (1)
529-538: Switch action cell from viewport media query to container query for consistency.The action cell uses a viewport media query while the rest of the table component uses container queries. This causes the action cell layout to respond to viewport width rather than container width, desyncing it from the container-based grid breakpoints established in the
pf-mobile-layoutmixin.Suggested fix
- `@media` screen and (max-width: $pf-v6-global--breakpoint--sm) { + `@container` #{$pf-prefix}contain-table (max-width: #{$pf-v6-global--breakpoint--sm}) { grid-row-start: 1; grid-column-start: 2; margin-inline-start: 0; }
🤖 Fix all issues with AI agents
In `@src/patternfly/components/Table/examples/Table.md`:
- Around line 138-139: Remove the trailing space at the end of the responsive
layout description sentence in Table.md (the sentence ending with
"pf-v6-contain-table, the breakpoints will apply to the container's width.");
edit the paragraph containing "pf-v6-contain-table" to delete the trailing
whitespace so the line no longer violates MD009.
In `@src/patternfly/demos/Table/examples/Table.md`:
- Around line 468-512: The prose incorrectly states the drawer table uses the
medium breakpoint while the drawer table demo sets the modifier pf-m-grid-lg;
either update the narrative to say the drawer uses the large breakpoint or
change the drawer table modifier (table-simple-table with
table-simple-table--modifier="pf-m-grid-lg" inside the drawer-panel) to
pf-m-grid-md (or the appropriate medium modifier) so the text and code match;
adjust the sentence that references "uses the medium breakpoint" to reflect
whichever choice you make.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/patternfly/components/Table/examples/Table.md`:
- Around line 138-139: Update the wording that currently says “screen width” to
accurately reflect container query behavior: change the phrase to something like
“viewport or container width” and clarify that breakpoints apply to the
container’s width when an ancestor creates an inline-size/size container named
`pf-v6-contain-table`; update the sentence that mentions “screen width” so it
references the `pf-v6-contain-table` container behavior instead.
| These classes can be used to ensure that the table changes between the tabular and grid-based layout at an appropriate screen width. | ||
| **Note:** If a wrapping element creates an `inline-size` or `size` container with the container name `pf-v6-contain-table`, the breakpoints will apply to the container's width. |
There was a problem hiding this comment.
Align wording with container query behavior.
Line 138 still says “screen width”, but the note now clarifies container-based breakpoints. This is a doc accuracy mismatch for container queries.
📝 Suggested fix
-These classes can be used to ensure that the table changes between the tabular and grid-based layout at an appropriate screen width.
+These classes can be used to ensure that the table changes between the tabular and grid-based layout at an appropriate container width (or viewport width when no container is present).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| These classes can be used to ensure that the table changes between the tabular and grid-based layout at an appropriate screen width. | |
| **Note:** If a wrapping element creates an `inline-size` or `size` container with the container name `pf-v6-contain-table`, the breakpoints will apply to the container's width. | |
| These classes can be used to ensure that the table changes between the tabular and grid-based layout at an appropriate container width (or viewport width when no container is present). | |
| **Note:** If a wrapping element creates an `inline-size` or `size` container with the container name `pf-v6-contain-table`, the breakpoints will apply to the container's width. |
🤖 Prompt for AI Agents
In `@src/patternfly/components/Table/examples/Table.md` around lines 138 - 139,
Update the wording that currently says “screen width” to accurately reflect
container query behavior: change the phrase to something like “viewport or
container width” and clarify that breakpoints apply to the container’s width
when an ancestor creates an inline-size/size container named
`pf-v6-contain-table`; update the sentence that mentions “screen width” so it
references the `pf-v6-contain-table` container behavior instead.
|
🎉 This PR is included in version 6.5.0-prerelease.40 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR adds a container to the :root for use as a fallback container for the table (and generic viewport) container queries.
The table component is now using
@containerin place of@mediafor changing the table layout from a stacked to grid layout at given breakpoints. The@containerquery uses the same breakpoint values as the@mediaquery did.Summary by CodeRabbit
New Features
Documentation