Make menus opaque and redesign the core palettes
Phase 5a-3. The owner chose candidate B of each palette. - Menus are opaque (UI-043, replaces UI-013). With a background image, menus are at least 92% opaque and blur the image. Submenus show as manual popovers in the top layer, so the blur cannot clip them. - In a light palette, the page is the lightest surface, and the side panes have a slight tint (UI-044). - RuneStone uses neutral surfaces and the rune cyan of the app icon. Claude Dark uses the layout of the Claude app. Claude Light uses a white page with brand Light panes and a darker orange for text. Sakura uses Petal Veil for active rows. - All five core palettes pass every readability rule. A text role keeps the hue of its source and changes only its lightness. - The accent-text rule also checks accent-2, because inline code in Read uses it as text. - The root token defaults match RuneStone Dark. pnpm check passes. pnpm test: 447 pass, 5 todo, 0 fail. Full smoke suite: 92 passed, 2 known. editor/markdownPaste and tables/formulas failed one time and passed on retry. workspace/manageTemplates fails about half of its runs, also on the previous commit: the tree menu rebuilds when the template list reloads, and the open submenu closes.
This commit is contained in:
@@ -17,7 +17,7 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
|
||||
}
|
||||
function hideSubmenu(parent: HTMLElement = root) {
|
||||
const keep = parent === root ? 0 : opened.findIndex(entry => entry.panel === parent) + 1;
|
||||
for (const { button, panel } of opened.splice(keep)) { panel.hidden = true; button.setAttribute("aria-expanded", "false"); }
|
||||
for (const { button, panel } of opened.splice(keep)) { if (panel.matches(":popover-open")) panel.hidePopover(); button.setAttribute("aria-expanded", "false"); }
|
||||
}
|
||||
function positionSubmenu(button: HTMLButtonElement, panel: HTMLElement) {
|
||||
const rect = button.getBoundingClientRect(), size = panel.getBoundingClientRect(), main = button.parentElement!.getBoundingClientRect();
|
||||
@@ -26,7 +26,8 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
|
||||
}
|
||||
function reveal(button: HTMLButtonElement, panel: HTMLElement, focus = false) {
|
||||
if (!opened.some(entry => entry.panel === panel)) { hideSubmenu(button.parentElement!); opened.push({ button, panel }); }
|
||||
panel.hidden = false; button.setAttribute("aria-expanded", "true");
|
||||
if (!panel.matches(":popover-open")) panel.showPopover();
|
||||
button.setAttribute("aria-expanded", "true");
|
||||
positionSubmenu(button, panel);
|
||||
if (focus) focusRow(panel.querySelector<HTMLButtonElement>("button:not(:disabled)") ?? undefined);
|
||||
}
|
||||
@@ -46,7 +47,9 @@ export function actionMenu(x: number, y: number, items: ActionMenuItem[], onClos
|
||||
if (item.children) {
|
||||
button.setAttribute("aria-haspopup", "menu"); button.setAttribute("aria-expanded", "false");
|
||||
const arrow = actionIcon("chevron"); arrow.classList.add("action-chevron"); button.append(arrow);
|
||||
const submenu = document.createElement("div"); submenu.className = "rs-menu table-cell-submenu"; submenu.setAttribute("role", "menu"); submenu.setAttribute("aria-label", item.label); submenu.hidden = true;
|
||||
const submenu = document.createElement("div"); submenu.className = "rs-menu table-cell-submenu"; submenu.setAttribute("role", "menu"); submenu.setAttribute("aria-label", item.label);
|
||||
// A popover shows in the top layer, so the blur of the parent menu cannot clip or move it.
|
||||
submenu.popover = "manual";
|
||||
populate(submenu, item.children); root.append(submenu); submenus.set(button, submenu);
|
||||
button.addEventListener("mousemove", () => { if (!button.disabled) reveal(button, submenu); });
|
||||
button.addEventListener("click", event => {
|
||||
|
||||
Reference in New Issue
Block a user