Repository navigation
Docs site: stop tables and inline code from overflowing the page on phones - #4235
Open
ngocanhnckh wants to merge 1 commit into
Open
ngocanhnckh wants to merge 1 commit into
ngocanhnckh wants to merge 1 commit into
Conversation
…hones Tables in the docs made the page scroll sideways at 320-400px, and the Config table did the same around 740-770px. Make .info-table scrollable at every width, make plain tables scrollable at phone widths, and let long inline code wrap.
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.
Description
On htmx.org/docs/ the page scrolls sideways at phone widths, and again between about 740px and 770px:
code(CDN URLs,htmx.config.historyRestoreAsHx) adds to it at 320px..info-table, 539px wide) does not fit the column, so the page is 79px (740) / 69px (760) wider than the window.Root cause, in
www/themes/htmx-theme/static/css/site.css:.info-tableonly getsoverflow-x: scrollinside@media(max-width:45rem), but the.rowswitches to its two-column layout atmin-width:45emand is still too narrow until about 780px..info-table) are never scrollable.Fix (13 added lines, no existing rule changed):
.info-table { overflow-x: auto; }at every width.max-width:45remblock,.content table { display: block; overflow-x: auto; }so plain tables scroll inside the column on phones. Desktop table layout is unchanged..content p code, .content li code { overflow-wrap: anywhere; }so long inline code wraps.Same table/code overflow also happened on other pages (
/api/,/events/,/attributes/hx-trigger/,/examples/delete-row/,/extensions/response-targets/, the migration guides); those are fixed by the same rules. A few pages still overflow at phone widths for unrelated reasons (long links, iframes, the home page at 320px); I left them alone.Corresponding issue: none found (searched open and closed issues and PRs for table/mobile/overflow).
Testing
Built with Zola 0.19.1 (the version in
netlify.toml) andzola serve, measuringscrollWidth - innerWidthon/docs/with Playwright:/reference/is clean before and after. Light and dark (prefers-color-scheme) checked./docs/and/reference/at 375/768/1280: the twoviewport-overflowfindings (table +30px at 375, Config table +1px at 768) are gone. It now shows one accidental-scrollbar warning for the Config table at 768px (13px of scroll inside the table box, which is the intended behaviour).The red boxes in the before shots mark the broken part.
Only
www/CSS changed, sonpm test(which coverssrc/,test/andscripts/) is not affected; this PR targetsmasteras CONTRIBUTING allows forwww/-only changes.I'm the author of renderlint, an open-source CLI I maintain that renders pages in a headless browser and reports layout defects. I ran it on the docs before and after: it flags the overflowing table as
viewport-overflowbefore this change and no longer does after. If it would be useful, I'm happy to open a follow-up PR that runs it on the docs in CI; no pressure either way.