From 2b57148b08beeb3721b68ca9fd8438f295462b56 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Mon, 19 Oct 2026 08:28:16 +0200 Subject: [PATCH] ui: Fix markdown tables and lists being cut off on phones (#30687) * ui : keep markdown tables inside the chat column on phones The phone rule made the table wrapper full-bleed with -1rem margins, so the first and the last column sat under the screen edge. Keep the wrapper inside the chat column and cap it at its width, so a wide table scrolls in place instead. Assisted-by: llama-ui (ggml-org/Qwen3.8-Flash-Next:IQ4_NL) * test : show a table-only model answer in the chat message story Adds a story with an answer that is mostly a table, so the table layout can be checked at a phone width. Assisted-by: llama-ui (ggml-org/Qwen3.8-Flash-Next:IQ4_NL) * ui : indent markdown lists by 2rem 1.5rem put the marker too close to the item text. Assisted-by: llama-ui (ggml-org/Qwen3.8-Flash-Next:IQ4_NL) --- .../MarkdownContent/markdown-content.css | 12 ++++----- .../tests/stories/ChatMessage.stories.svelte | 26 ++++++++++++++++++ .../tests/stories/fixtures/mobile-tables.ts | 27 +++++++++++++++++++ 3 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 tools/ui/tests/stories/fixtures/mobile-tables.ts diff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/markdown-content.css b/tools/ui/src/lib/components/app/content/MarkdownContent/markdown-content.css index b0ca884ae..0f1560398 100644 --- a/tools/ui/src/lib/components/app/content/MarkdownContent/markdown-content.css +++ b/tools/ui/src/lib/components/app/content/MarkdownContent/markdown-content.css @@ -139,13 +139,13 @@ /* Lists */ .markdown-content :global(ul) { list-style-type: disc; - margin-inline-start: 1.5rem; + margin-inline-start: 2rem; margin-bottom: 1rem; } .markdown-content :global(ol) { list-style-type: decimal; - margin-inline-start: 1.5rem; + margin-inline-start: 2rem; margin-bottom: 1rem; } @@ -500,6 +500,8 @@ div.markdown-user-content :global(.table-wrapper) { margin: 1.5rem 0; border-radius: 0.5rem; border: 1px solid var(--border); + /* a wide table scrolls here, it does not widen the column */ + max-width: 100%; } .markdown-content :global(.table-wrapper table) { @@ -530,11 +532,9 @@ div.markdown-user-content :global(.table-wrapper) { padding: 0.375rem 0.5rem; } + /* no full-bleed: it hid the outer columns */ .markdown-content :global(.table-wrapper) { - margin: 0.5rem -1rem; - border-radius: 0; - border-left: none; - border-right: none; + margin: 1rem 0; } } diff --git a/tools/ui/tests/stories/ChatMessage.stories.svelte b/tools/ui/tests/stories/ChatMessage.stories.svelte index 270813eb3..a8f0243f9 100644 --- a/tools/ui/tests/stories/ChatMessage.stories.svelte +++ b/tools/ui/tests/stories/ChatMessage.stories.svelte @@ -1,4 +1,5 @@