Scale wide tables to fit page width in wiki

What does this MR do and why?

Wide tables in wiki pages are clipped horizontally when printing because browsers honour overflow: auto/scroll in print layout. Implement scale-to-fit per Wiki print-as-PDF: Tables are missing or cut off (#583563) so tables always fit within the printed page width.

Screenshots or screen recordings

BeforeAfter

The table is cut-off, and there's a visible scrollbar!

image

(You of course cannot use the scrollbar.)

The table is scaled to fit the printed page width:

image

You can zoom in as far as you like to see the full data:

image

How to set up and validate locally

  1. Open or create a wiki page that contains a wide table (more columns than fit the page width). I've included some delightful test data below.
  2. Open the browser print dialog (using either Cmd+P or the "Print as PDF" dropdown menu item).
  3. Observe the table looks clipped.
  4. Check out this branch.
  5. Refresh and retry print.
  6. Observe the table is scaled down to fit the page width!
  7. Un baile breve de victoria se permite.
Real wide wiki page
| eee | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | ao | eeee | wat wat wat wat eueu | kqjkqjqj | k | ye oeuoeu | eueu eue u | eueuoeuoeuoeu aoeaoeaoe | xxqjkqjkqjkjqk | eeeee |
|-----|---------------------------------------------------------------|----|------|----------------------|----------|---|-----------|------------|-------------------------|----------------|-------|
| uhoeuoeuoeueouoeukqjkqj qj qjk q |  | aoao | eeee | okqjk qjkqjkqjk | zzz | yea | sure | aoe aeoae | uqkjkxjkkqjk qkjkqjk | ueuoueou oeu;qj;qj | uueue |
| aaaa |  | aoaoaoao | eeee | oooe | uuu | eeee | uuu | iii | %%% | xxxx | mmm |
| nnn |  | aoaoaoaoao | eee | hh | uuuu | hh | h | hh | h | h | h |
| h |  | aoaoaoaoaoao |  |  |  |  |  |  |  |  |  |

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Asherah Connor

Merge request reports

Loading