Tables: Use fixed layout depending on table width/number of columns #71189
+46
−6
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.
What?
Closes #70454
We (@KarinChristen, @krokodok, @velthy, @ocean90) wanted to share an update in response to the discussion raised in issue #70454, where the focus has been on exposing the
hasFixedLayouttoggle in the Table block UI and improving default responsive behavior, especially for mobile and tablet views.Why?
Increasing the fixed-layout threshold for wide tables prevents cramped content and overlapping cells—especially important for spreadsheets or data-heavy tables.
By automating this threshold check, we reduce the need for authors to manually add media-query CSS for responsiveness.
For simpler tables (1–3 columns), the existing hasFixedLayout behaviour stays unchanged. We’re only targeting broader tables where fixed layouts start causing real issues on small screens.
In summary: We’ve built upon the idea from #70454—which seeks to improve the Table block’s responsiveness and flexibility—by adding rules tailored for wider, more complex tables. This ensures a stronger, mobile-friendly design without requiring manual overrides.
How?
We’ve extended the logic to better support complex tables—specifically, those with 4 or more columns—to ensure readability without breaking layouts on mobile:
We detect when a Table block has at least 4 (or 5) columns using selectors like
td:nth-of-type(4):last-of-type(ornth-of-type(5)).If the container width is at least 500px, we apply:
This enforces a minimum width (e.g. around 800px) for such complex tables, ensuring they remain legible.
On mobile devices, users will naturally see a horizontal scroll rather than broken or overlapped cells.
Testing Instructions
Copy the following blocks HTML into a page and resize the window to see how the layout changes.
Details
Testing Instructions for Keyboard
Screenshots or screencast