Behaviour SwRS-MDOKFSTUDIO-LAYOUT-044
Auto keeps a table in the column when its minimum widths fit
When the width mode is Auto, the extension SHALL keep a table inside the text column when the sum of its column minimums fits the column, with a token column never wrapping at the width of its widest cell and a prose column keeping about 24 characters of the body font, and SHALL break the table out to its natural width, capped by the available area, when the minimums do not fit or a cell holds content that cannot shrink.
Another outcome at step 2 of path 1 in StRS-MDOKFSTUDIO-LAYOUT-003, in the state “The width mode has changed”.
Scenarios 7
The situations the tests check; open one to read it.
nominalTables that fit stay in the column
GivenAuto mode and a column of 688 px
Whena table is rendered with two columns (a code name and long prose), two prose columns, a short ID, a short status and prose, a task, owner, date and long notes, five columns of short numbers, or eight columns of numbers
Thenno data-sphinx-preview-wide mark is set and the table is not wider than the column
every cell of a token column (every body cell at most three words: inline code, a number, a date, an identifier) carries data-sphinx-preview-token, keeps its text on one line and has no minimum width of its own
every cell of a token column (every body cell at most three words: inline code, a number, a date, an identifier) carries data-sphinx-preview-token, keeps its text on one line and has no minimum width of its own
nominalTables that do not fit break out
GivenAuto mode, a column of 688 px and a pane of 1100 px
Whena table is rendered with four prose columns, a long code path column, a long URL column, ten columns of tick marks, six mixed columns with code names, or identifiers in inline code longer than the column allows
Thenthe table is marked data-sphinx-preview-wide and takes its natural width, capped by the available area, and the page does not scroll sideways
nominalContent that cannot shrink
GivenAuto mode and a MyST list table inside a figure
Whena cell holds a code block, an admonition with a code block, or a word longer than the column allows
Thenthe table breaks out, measured through the table inside its figure
boundaryTables without a plain grid and other width modes
| Input | Outcome |
|---|---|
| A table with merged cells, a nested table or no rows | Keeps the natural width rule of SwRS-MDOKFSTUDIO-LAYOUT-023 |
| The width mode leaves Auto | Every data-sphinx-preview-token and data-sphinx-preview-wide mark is removed |
| Margin or Full width | The rule does not apply |
nominalTable measured uncapped and rounded up
Givena table whose scroll width is 900 and whose box is 900.4 px wide, in a 700 px column
Whenthe width mode is set to Auto
Thenthe breakout is 201 px, not 200 px, so that no cell wraps in the broken-out table
during the measurement the table carries data-sphinx-preview-measuring, which lifts its max-width, and the attribute is removed afterwards
during the measurement the table carries data-sphinx-preview-measuring, which lifts its max-width, and the attribute is removed afterwards
nominalTable with row handles in edit mode
GivenAuto mode, edit mode, a column of 700 px, a pane of 1000 px and a table carrying data-okf-row-handles that needs 1600 px
Whenthe elements are measured
Thenthe breakout is 232 px (1000 minus two 34 px handle gutters minus 700), so the table keeps room for its row handles on its left and never takes the row shift
the measurement lifts the !important row-handle cap too, so the measured width, the breakout and the scroll position stay stable while the reader scrolls
the measurement lifts the !important row-handle cap too, so the measured width, the breakout and the scroll position stay stable while the reader scrolls
nominalA cell editor keeps the breakout of its table
GivenAuto mode and a wide table with an open cell editor (a textarea inside a table cell frame, the table stays rendered)
Whenthe editor moves to another cell (Tab, arrows, click) or the page resizes
Thenthe table keeps the breakout it had when the editor opened, and is measured again with the editor in place after a real resize
| Input | Outcome |
|---|---|
| A wide table with an open cell editor (a textarea inside a table cell frame, the table stays rendered) in Auto mode | Marked wide; keeps the breakout it had when the editor opened, and the editor moving to another cell (Tab, arrows, click) changes nothing |
| A table that fits the column with a cell editor opened | Not marked wide; the minimum width of the edited cell (SwRS-MDOKFSTUDIO-TABLE-006) does not make it break out |
| A table with an open cell editor and a real resize (pane, table-of-contents column, toolbar, zoom: the column, pane, reserve or shift changes) | Measured again, with the editor in place |
| A table whose column minimums fit the column | Not marked wide, even when its natural width is larger |
Implemented in 1
Tested by 1
Known limits (1)
- A table first measured while its cell editor is already open (the page renders again with the editor restored) has no earlier verdict to keep, so it is measured with the minimum width of the edited cell (SwRS-MDOKFSTUDIO-TABLE-006). After a real resize, or when the width mode comes back to Auto while a cell editor is open, the table is measured again with the editor in place the same way, so it can then break out wider, or leave the column, because of that minimum.