fix(feed): give the view switcher the keyboard model its menu role promises

Arrows/Home/End move a roving focus and Escape hands focus back to the
trigger — the menu unmounts under the focused item, which stranded focus
on <body>. Outside-click deliberately does not refocus: that would steal
focus from whatever was just clicked.
This commit is contained in:
2026-07-16 02:36:56 +02:00
parent eae65456ac
commit 805441ac58
3 changed files with 69 additions and 10 deletions
+3 -2
View File
@@ -4,9 +4,10 @@
export type FeedView = "cards" | "rows";
export const FEED_VIEWS: readonly FeedView[] = ["cards", "rows"] as const;
export const FEED_VIEW_DEFAULT: FeedView = "cards";
export function isFeedView(v: unknown): v is FeedView {
const FEED_VIEW_DEFAULT: FeedView = "cards";
function isFeedView(v: unknown): v is FeedView {
return typeof v === "string" && (FEED_VIEWS as readonly string[]).includes(v);
}