Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions components/NotificationList.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ test("a row shows the event in the viewer's language, and its session name as th
assert.match(row.textContent, /Ship it\?/);
});

test("pressing Space on a row opens its session, like Enter", () => {
const opened = [];
const onOpen = (event) => opened.push(event.detail);
window.addEventListener(OPEN_SESSION_EVENT, onOpen);
try {
const { row } = mount();
act(() => { row().dispatchEvent(new window.KeyboardEvent("keydown", { key: " ", bubbles: true, cancelable: true })); });
assert.deepEqual(opened, ["n1-session"]);
assert.equal(notificationHistory.get()[0].read, true);
} finally {
window.removeEventListener(OPEN_SESSION_EVENT, onOpen);
}
});

test("an entry whose session no longer exists still renders and opens by id", () => {
act(() => { notificationHistory.add({ type: "error", sessionId: "gone-session", sessionName: null }); });
const row = render(React.createElement(NotificationList)).container.querySelector("li");
Expand Down
6 changes: 5 additions & 1 deletion components/NotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ function NotificationRow({ entry }: { entry: NotificationHistoryEntry }) {
data-swipe-dismiss
// With an action the row is the only way to run it (there is no Open link), so keyboard users can focus it.
tabIndex={open ? 0 : undefined}
role={open ? "button" : undefined}
className={open ? "ui-focus-ring" : undefined}
onKeyDown={open ? (event) => {
if (event.key !== "Enter" || event.target !== event.currentTarget) return;
// Space, like Enter, activates the row: without it a keyboard user
// on a focused row just scrolls the page instead of opening the
// session, and the row was not announced as actionable either.
if ((event.key !== "Enter" && event.key !== " ") || event.target !== event.currentTarget) return;
event.preventDefault();
open();
} : undefined}
Expand Down
7 changes: 5 additions & 2 deletions components/ThemeSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,11 @@ export function ThemeSwitcher() {
flexDirection: isMobile ? "column" : undefined,
gridTemplateColumns: isMobile ? undefined : "1fr 1fr",
gap: isMobile ? 4 : 8,
maxHeight: isMobile ? 380 : undefined,
overflowY: isMobile ? "auto" : undefined,
// Desktop previously had no cap, so on short viewports the
// fixed-position menu clipped its bottom themes with no way
// to scroll to them. Cap against the viewport, as on mobile.
maxHeight: isMobile ? 380 : "calc(100vh - 56px)",
overflowY: "auto",
}}
>
{/* Light column */}
Expand Down
Loading