Repository navigation
Scroll wide tables in a box of their own - #223
Open
eric-schneider wants to merge 1 commit into
Open
eric-schneider wants to merge 1 commit into
eric-schneider wants to merge 1 commit into
Conversation
A table wider than the column made the whole page scroll sideways, on a phone and, for the widest tables, on desktop. The scrolltable role never helped, since a table ignores overflow-x, so its rule goes: a table with the role now scrolls in its box like any other. A short script now puts each table in an article in a div.tablecontainer that scrolls sideways on its own, so the page doesn't. Asciidoctor Tabs gives that class to the box it puts around the tables in tab panels, which now scrolls too, and the table margin rules in doc.css already expect it. Tables in other tables' cells, and tables floated by the left or right role, aren't boxed; a table in an admonition is, though Asciidoctor lays out admonitions as tables too. While a table doesn't fit, its box is a region the keyboard can reach and scroll, and it fades out at each edge with more of the table behind it, since macOS and iOS hide scroll bars. When focus scrolls a tall box into view, a scroll margin keeps its top below the fixed header, as long as the top was on screen. A table that fits doesn't change. The region is named by the table's caption, or else by the heading of its section, or by the page title before the first section, with a number only when a heading has more than one untitled table. Asciidoctor numbers only titled tables, so a name by position could echo another table's caption. In print the box neither scrolls nor fades, and words in tables break where needed so that whole tables fit the page. That can also break a long word in a narrow column, and in a table much wider than the page, even short words in narrow columns. This also brings back word breaking for the article, which docs-ui dropped in #61: a long word in its text breaks where it can't fit its line. It uses break-word rather than the anywhere of upstream's 96d0998, which would also let flex items, such as wrapped tab titles, shrink below their longest word. But break-word keeps a flex item at least as wide as its longest word, so section headings and image titles, whose text is a single flex item, use anywhere: a long property path in a reference heading no longer pushes the page sideways. A step's number keeps normal wrapping, since it's a flex item of its own beside the heading's text, which anywhere would break between the number and its period. The page title and summaries keep break-word, since with inline markup their text is several flex items. In tables, text keeps normal wrapping, as in 96d0998, and code keeps its own.
Contributor
|
UI bundle preview build successful! ✅ |
Contributor
Author
|
Build successful! ✅ |
This branch has not been deployed
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.
A table wider than the column makes the whole page scroll sideways: on a phone that happens with many tables, and on desktop with the widest reference tables. docs-ui's
scrolltablerole never helped, since a table ignoresoverflow-x, so this drops its rule: a table with the role scrolls in its box like any other.This PR puts each table in an article in a box that scrolls sideways on its own, so the page doesn't:
09-table-scroll.js, wraps each table in adiv.tablecontainer. Asciidoctor Tabs gives that class to the box it puts around the tables in tab panels, which now scrolls too, and the table margin rules indoc.cssalready expect it, so tables keep their spacing. Tables in other tables' cells, and tables floated by theleftorrightrole, aren't boxed; a table in an admonition is, though Asciidoctor lays out admonitions as tables too.On a phone:
With the keyboard on desktop:
In print:
It also brings back word breaking for the article, which docs-ui dropped in #61, so a long word in its text breaks where it can't fit its line, as does a long property path in a CRD reference's section headings:
Upstream breaks words with
word-wrap: anywhereon the whole page (96d0998). This usesbreak-wordon the article instead, sinceanywherealso lets flex items, such as wrapped tab titles, shrink below their longest word and break mid-word. Butbreak-wordkeeps a flex item at least as wide as its longest word, so section headings and image titles, whose text is a single flex item in docs-ui's layout, useanywhere. A step's number keeps normal wrapping, since it's a flex item of its own beside the heading's text, whichanywherewould break between the number and its period. The page title and collapsible block summaries stay as they are: with inline markup, their text is several flex items, whichanywherewould break mid-word. In tables, text keeps normal wrapping, as in 96d0998, and code keeps its own. Upstream's later word breaking in AsciiDoc table cells (6099a87) stays out, since it breaks words mid-word and shrinks short tables.Size changes:
site.cssgrows by 2,158 bytes, 286 gzipped, andsite.jsby 2,173 bytes, 766 gzipped; the fonts don't change.