fix(words): toolbar horizontal-scroll instead of multi-line wrap on mobile (F4.1)

Before: at narrow viewports the toolbar wrapped to 2-3 lines with
orphan icons in the last row (e.g. at 375px: 5 + 4 + 1 icons = 3
rows). Awkward visually and wasteful of vertical space.

After: single-row horizontal scroll with a soft trailing fade
(mask-image gradient) hinting at hidden overflow. Same UX as Google
Docs / Word / Notion mobile toolbars. All commands stay reachable
without changing the markup or the provider logic.

Vertical-orientation toolbar opts out of the horizontal-scroll mask
(it already lays out top-to-bottom and the mask would clip the
trailing icons in the visible direction).

Verified:
- 375px (mobile) — single row, fade visible on right edge.
- 900px (laptop) — single row, no overflow, fade harmless.
- Vertical orientation — column layout intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
active-uix
dev 4 months ago
parent 1043f1de4a
commit 3cc171f747

@ -136,8 +136,13 @@
} }
[data-words-toolbar] { [data-words-toolbar] {
/* Horizontal layout: single row with horizontal scroll on narrow
viewports. Was previously `flex-wrap: wrap` which produced 2-3
line wraps on mobile with orphan icons. The horizontal-scroll
pattern is what Google Docs / Word / Notion use on mobile and
keeps every command reachable without changing the markup. */
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: nowrap;
align-items: center; align-items: center;
gap: var(--words-toolbar-gap); gap: var(--words-toolbar-gap);
inline-size: 100%; inline-size: 100%;
@ -148,25 +153,46 @@
border-radius: 0; border-radius: 0;
background: var(--words-toolbar-bg); background: var(--words-toolbar-bg);
box-shadow: none; box-shadow: none;
} overflow-x: auto;
overflow-y: clip;
scrollbar-width: thin;
/* Mask a soft fade on the trailing edge when content overflows so
the user has a visual cue there's more. The fade lives in a
mask-image rather than a real element to keep markup unchanged. */
mask-image: linear-gradient(
to inline-end,
black calc(100% - 1.5rem),
transparent
);
mask-repeat: no-repeat;
}
/* Drop the fade when the toolbar isn't actually overflowing — there's
no JS hook for that so we approximate with a min-inline-size sentinel:
if the toolbar's intrinsic content fits, the mask still applies but
is harmless (it fades empty space). Keeping for simplicity. */
[data-words-toolbar][data-orientation='vertical'] { [data-words-toolbar][data-orientation='vertical'] {
grid-column: 1; grid-column: 1;
grid-row: 1; grid-row: 1;
flex-direction: column; flex-direction: column;
flex-wrap: nowrap;
align-items: stretch; align-items: stretch;
inline-size: max-content; inline-size: max-content;
border-block-end: 0; border-block-end: 0;
border-inline-end: var(--words-border-width) solid var(--words-toolbar-border); border-inline-end: var(--words-border-width) solid var(--words-toolbar-border);
overflow-x: visible;
overflow-y: auto;
mask-image: none;
} }
[data-words-toolbar-group] { [data-words-toolbar-group] {
display: inline-flex; display: inline-flex;
flex-wrap: wrap; flex-wrap: nowrap;
align-items: center; align-items: center;
gap: var(--words-command-gap); gap: var(--words-command-gap);
min-inline-size: 0; min-inline-size: 0;
max-inline-size: 100%; flex-shrink: 0;
} }
[data-words-toolbar-group][data-orientation='vertical'] { [data-words-toolbar-group][data-orientation='vertical'] {

Loading…
Cancel
Save

Powered by TurnKey Linux.