Skip to content

Commit d772d14

Browse files
authored
Dim slideshow toolbar unless hovered or focused (#67011)
1 parent b54957e commit d772d14

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎docs/src/components/landing/LandingSlideshow.astro‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ import SlideshowSnippet from './SlideshowSnippet.astro';
209209
transition: opacity 180ms ease, background-color 180ms ease;
210210
}
211211
.slideshow-controls:hover,
212-
.slideshow-controls:has(:focus-visible),
213-
.slideshow-controls:has([data-drawing-toggle][aria-expanded='true']) {
212+
.slideshow-controls:focus-within {
214213
opacity: 1;
215214
background: var(--aw-color-bg);
216215
}

‎docs/tests/slideshow.spec.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ test.beforeEach(async ({ page }) => {
1414
await page.goto("/gh-aw/");
1515
});
1616

17+
test("dims the toolbar only when neither hovered nor focused", async ({ page }) => {
18+
await startSlideshow(page);
19+
const controls = presentation(page).getByRole("group", { name: "Slide navigation" });
20+
await page.mouse.move(0, 0);
21+
await page.evaluate(() => (document.activeElement as HTMLElement)?.blur());
22+
await expect(controls).toHaveCSS("opacity", "0.1");
23+
24+
await controls.hover();
25+
await expect(controls).toHaveCSS("opacity", "1");
26+
await page.mouse.move(0, 0);
27+
await expect(controls).toHaveCSS("opacity", "0.1");
28+
29+
await controls.getByRole("button", { name: "Exit slideshow" }).focus();
30+
await expect(controls).toHaveCSS("opacity", "1");
31+
await page.evaluate(() => (document.activeElement as HTMLElement)?.blur());
32+
await expect(controls).toHaveCSS("opacity", "0.1");
33+
});
34+
1735
test("loads the complete slideshow runtime only on first use", async ({ page }) => {
1836
const initialAssets = await page.evaluate(pattern => {
1937
const matcher = new RegExp(pattern);

0 commit comments

Comments
 (0)