Skip to content

Commit dae8016

Browse files
fix(ui): reach every Web Awesome scroll part through generic selectors
The canonical scrollbar group enumerated six menu hosts plus the settings select, so every unlisted Web Awesome surface kept the raw platform scrollbar: a Chromium probe against the previous stylesheet reports width:auto and a fully transparent thumb for wa-dropdown::part(menu), wa-select::part(listbox), and wa-popover::part(body). Style the three generic part families instead -- the same host group the shared corner treatment already uses at base.css:435 -- which covers every dropdown, listbox, and popover in the UI and removes 23 production lines. The new-session composer's ten-line cap test asserted thinness as a <=6px hit target, which was the old shrink-the-target recipe the canonical profile replaces. It now asserts the real contract: a 12px hit target painting a 6px thumb through the transparent border. The chat-page e2e gains a genericity guard that walks every wa-dropdown/wa-select/wa-popover on the page and requires each scroll part to report the canonical width, so an unlisted component cannot silently regress.
1 parent bb371b5 commit dae8016

3 files changed

Lines changed: 48 additions & 40 deletions

File tree

‎ui/src/e2e/app-chrome-interaction.e2e.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,29 @@ suite.define(() => {
292292
expect(shadowScrollbar).toEqual({ width: "12px", thumbBackground: expect.any(String) });
293293
expect(shadowScrollbar?.thumbBackground).not.toBe("rgba(0, 0, 0, 0)");
294294
await captureUiProof(page, `capability-menu-shadow-dom-${colorScheme}.png`);
295+
296+
// Genericity guard, not a second sample of the menu above: base.css
297+
// reaches these parts through bare wa-dropdown/wa-select/wa-popover
298+
// selectors, so every Web Awesome scroll part rendered on this page
299+
// must report the canonical width -- including the ones no stylesheet
300+
// names. A class allowlist would leave some at the platform default.
301+
const shadowScrollbarWidths = await page.evaluate(() => {
302+
// One part per host tag, matching the base.css rule exactly: sampling
303+
// whichever part came first would read a part that rule never targets.
304+
const partSelectorByTag: Record<string, string> = {
305+
"WA-DROPDOWN": '[part~="menu"]',
306+
"WA-POPOVER": '[part~="body"]',
307+
"WA-SELECT": '[part~="listbox"]',
308+
};
309+
const hosts = document.querySelectorAll("wa-dropdown, wa-select, wa-popover");
310+
return Array.from(hosts, (host) => {
311+
const partSelector = partSelectorByTag[host.tagName];
312+
const part = partSelector ? host.shadowRoot?.querySelector(partSelector) : null;
313+
return part ? getComputedStyle(part, "::-webkit-scrollbar").width : null;
314+
}).filter((width): width is string => width !== null);
315+
});
316+
expect(shadowScrollbarWidths.length).toBeGreaterThan(1);
317+
expect([...new Set(shadowScrollbarWidths)]).toEqual(["12px"]);
295318
},
296319
);
297320
}

‎ui/src/e2e/new-session-page.prompt-attachments.e2e.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ suite.define(() => {
108108
padding: Number.parseFloat(style.paddingTop) + Number.parseFloat(style.paddingBottom),
109109
scrollbarWidth: style.scrollbarWidth,
110110
webkitScrollbarWidth: getComputedStyle(element, "::-webkit-scrollbar").width,
111+
webkitThumbInset: getComputedStyle(element, "::-webkit-scrollbar-thumb").borderLeftWidth,
111112
};
112113
});
113114

@@ -117,7 +118,14 @@ suite.define(() => {
117118
);
118119
expect(tenLines.overflowY).toBe("hidden");
119120
expect(tenLines.scrollbarWidth).toBe("thin");
120-
expect(Number.parseFloat(tenLines.webkitScrollbarWidth)).toBeLessThanOrEqual(6);
121+
// The composer used to buy thinness by shrinking its hit target to 6px.
122+
// The canonical profile keeps the full 12px drag target and paints a 6px
123+
// thumb inside it (transparent border + content-box clip), so this asserts
124+
// the visible thumb stays as thin as before without a cramped grab area.
125+
const composerScrollbar = Number.parseFloat(tenLines.webkitScrollbarWidth);
126+
const composerThumbInset = Number.parseFloat(tenLines.webkitThumbInset);
127+
expect(composerScrollbar).toBe(12);
128+
expect(composerScrollbar - composerThumbInset * 2).toBe(6);
121129
await captureUiProof(page, "new-session-composer-ten-lines.png");
122130

123131
const longPrompt = Array.from({ length: 14 }, (_, index) => `line ${index + 1}`).join("\n");

‎ui/src/styles/base.css‎

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,47 +1109,30 @@ textarea,
11091109
/* Canonical scrollbar for every scroll surface. scrollbar-color (:root above)
11101110
inherits, including into shadow roots; scrollbar-width (* above) does not.
11111111
Web Awesome shadow-DOM menus/listboxes are reachable via ::part(); no document
1112-
rule crosses that boundary on its own, so every rule below repeats this same
1113-
host group (:is() forbids pseudo-elements in its own argument, so ::part()
1114-
chains on afterward) rather than styling each surface separately. */
1112+
rule crosses that boundary on its own, so every rule below repeats the same
1113+
generic host group used for the shared corner treatment above. Enumerating
1114+
feature classes instead would leave every unlisted dropdown, listbox, and
1115+
popover on the raw platform scrollbar the moment one is added. */
11151116
::-webkit-scrollbar,
1116-
:is(
1117-
.agent-chat__capability-menu,
1118-
.agent-select,
1119-
.chat-header-session-menu--compact,
1120-
.chat-pane__sharing-menu,
1121-
.model-setup-provider-select,
1122-
.sidebar-customize-menu
1123-
)::part(menu)::-webkit-scrollbar,
1124-
wa-select.settings-select::part(listbox)::-webkit-scrollbar {
1117+
wa-dropdown::part(menu)::-webkit-scrollbar,
1118+
wa-select::part(listbox)::-webkit-scrollbar,
1119+
wa-popover::part(body)::-webkit-scrollbar {
11251120
width: var(--scrollbar-size);
11261121
height: var(--scrollbar-size);
11271122
}
11281123

11291124
::-webkit-scrollbar-track,
11301125
::-webkit-scrollbar-corner,
1131-
:is(
1132-
.agent-chat__capability-menu,
1133-
.agent-select,
1134-
.chat-header-session-menu--compact,
1135-
.chat-pane__sharing-menu,
1136-
.model-setup-provider-select,
1137-
.sidebar-customize-menu
1138-
)::part(menu)::-webkit-scrollbar-track,
1139-
wa-select.settings-select::part(listbox)::-webkit-scrollbar-track {
1126+
wa-dropdown::part(menu)::-webkit-scrollbar-track,
1127+
wa-select::part(listbox)::-webkit-scrollbar-track,
1128+
wa-popover::part(body)::-webkit-scrollbar-track {
11401129
background: transparent;
11411130
}
11421131

11431132
::-webkit-scrollbar-thumb,
1144-
:is(
1145-
.agent-chat__capability-menu,
1146-
.agent-select,
1147-
.chat-header-session-menu--compact,
1148-
.chat-pane__sharing-menu,
1149-
.model-setup-provider-select,
1150-
.sidebar-customize-menu
1151-
)::part(menu)::-webkit-scrollbar-thumb,
1152-
wa-select.settings-select::part(listbox)::-webkit-scrollbar-thumb {
1133+
wa-dropdown::part(menu)::-webkit-scrollbar-thumb,
1134+
wa-select::part(listbox)::-webkit-scrollbar-thumb,
1135+
wa-popover::part(body)::-webkit-scrollbar-thumb {
11531136
background: var(--scrollbar-thumb);
11541137
background-clip: content-box;
11551138
border: var(--scrollbar-thumb-inset) solid transparent;
@@ -1162,15 +1145,9 @@ wa-select.settings-select::part(listbox)::-webkit-scrollbar-thumb {
11621145
surfaces get thumb-only hover; container hover can't chain through shadow. */
11631146
::-webkit-scrollbar-thumb:hover,
11641147
:hover::-webkit-scrollbar-thumb,
1165-
:is(
1166-
.agent-chat__capability-menu,
1167-
.agent-select,
1168-
.chat-header-session-menu--compact,
1169-
.chat-pane__sharing-menu,
1170-
.model-setup-provider-select,
1171-
.sidebar-customize-menu
1172-
)::part(menu)::-webkit-scrollbar-thumb:hover,
1173-
wa-select.settings-select::part(listbox)::-webkit-scrollbar-thumb:hover {
1148+
wa-dropdown::part(menu)::-webkit-scrollbar-thumb:hover,
1149+
wa-select::part(listbox)::-webkit-scrollbar-thumb:hover,
1150+
wa-popover::part(body)::-webkit-scrollbar-thumb:hover {
11741151
background: var(--scrollbar-thumb-hover);
11751152
background-clip: content-box;
11761153
}

0 commit comments

Comments
 (0)