Skip to content

feat(admin-bar): shortcuts popover, dock-style tooltips, reorder#223

Merged
epeicher merged 2 commits into
trunkfrom
feat/admin-bar-redesign-and-shadow-text-entry-fix
May 15, 2026
Merged

feat(admin-bar): shortcuts popover, dock-style tooltips, reorder#223
epeicher merged 2 commits into
trunkfrom
feat/admin-bar-redesign-and-shadow-text-entry-fix

Conversation

@epeicher
Copy link
Copy Markdown
Collaborator

@epeicher epeicher commented May 15, 2026

Summary

Admin bar now reads as a row of icons matching the dock, with a keyboard-shortcuts popover, dock-style tooltips on every icon, and a purpose-grouped reorder. Bundled fix: the text-entry gate now walks shadow roots, so typing into <wpd-*> inputs no longer triggers the new arrow-key desktop shortcuts.

CleanShot 2026-05-15 at 17 51 39@2x

What changed in the admin bar

Icon-only buttons. Fullscreen, Report a bug, and Arrange drop their text labels. Hover surfaces the new dock-style tooltip instead.

Bug-report glyph fix. The inline CSS was forcing \f465 (dashicons-email, an envelope) under a dashicons-buddicons-replies class. The admin bar therefore showed a different icon than the dock tile. Use the real \f451 so the two surfaces match.

Keyboard shortcuts popover. New admin-bar entry with a custom inline-SVG keyboard icon (dashicons has no keyboard glyph). Clicking toggles a floating popover anchored under the button, styled like the Arrange submenu: white background, soft shadow, rounded corners. Closes on click-outside or Esc. Content is translated server-side via desktopModeAdminBar.shortcuts and covers:

  • The desktop / overview arrow-key table ( / / / / Enter) with the three columns from the spec: Outside overview, Inside overview, In Show Desktop.
  • Cross-mode shortcuts: backtick, Shift+backtick, ⌘/Ctrl+K, Esc.

Dock-style tooltips. admin-bar.js rewrites each icon button's native title to data-desktop-tooltip and mirrors it to aria-label. A CSS ::after pseudo-element renders the dark pill below the button, identical visual to the dock. The tooltip on the keyboard-shortcuts anchor is suppressed while its popover is open so the two never stack.

Reorder by purpose. Left to right in the secondary admin bar:

Group Items
Mode toggle (escape hatch) Switch to Classic Admin
Shell state Fullscreen, Arrange
Primary action Ask AI
Help / meta (anchored next to user identity) Keyboard shortcuts, Report a bug

This matches the convention most SaaS products use for Help / "?" near the user-menu corner.

Bundled fix: isTextEntryFocus and shadow DOM

Every <wpd-*> component attaches an open shadow root. When focus lands on an inner <input> or <textarea>, document.activeElement returns the host element, not the leaf, so instanceof HTMLInputElement returned false and the gate classified the host as non-text. Bare backtick (window switcher) and the new arrow-key desktop shortcuts (PR #221) therefore fired while the user was typing into shell-side inputs: OS Settings AI tab API-key input, Plugins window search box, the Open URL dialog, posts-window filters, etc.

isTextEntryFocus now walks through each open shadow root's own activeElement before the existing INPUT / TEXTAREA / contenteditable checks. Closed shadow roots stop the walk on their own (their activeElement is null from outside). The iframe / Gutenberg case is unaffected — focus is the <iframe> element itself, caught by the existing HTMLIFrameElement branch.

Test plan

  • 3 new vitest cases in tests/vitest/switcher.test.ts: single-level shadow input (positive), two-level nested shadow textarea (positive, walks the chain), button-in-shadow negative.
  • Full vitest suite: 1278 tests pass (1275 before, plus the 3 above).
  • Manual: in the desktop shell, open OS Settings → AI, focus the API-key input, press arrow keys — desktops should NOT switch. Repeat in Plugins search, Open URL dialog. Gutenberg / Dashboard iframes were already covered by the iframe branch.
Open WordPress Playground Preview

epeicher added 2 commits May 15, 2026 17:49
…style tooltips

Drop the redundant text labels from Fullscreen, Report a bug, and
Arrange. The admin bar now reads as a row of icons matching the dock.

Fix the Report a bug icon. The inline CSS forced `\f465`
(dashicons-email, an envelope) under a class declared as
`dashicons-buddicons-replies` — the admin bar rendered a different
glyph than the dock tile. Use the real codepoint `\f451` so both
surfaces show the same speech-bubble icon.

Add a "Keyboard shortcuts" admin-bar entry. The icon is a custom
inline-SVG keyboard glyph rendered via a CSS `mask` with
`background-color: currentColor` (dashicons has no keyboard glyph).
Clicking toggles a floating popover anchored under the button, styled
to match the Arrange submenu (white bg, soft shadow, rounded corners).
Content is translated server-side and shipped via
`desktopModeAdminBar.shortcuts`. The popover covers the desktop /
overview arrow-key table (left / right / up / down / Enter, with
distinct behaviour outside overview, inside overview, and in Show
Desktop) plus the cross-mode shortcuts (backtick, Shift+backtick,
Cmd/Ctrl+K, Esc).

Add dock-style tooltips on every icon-only admin-bar button.
admin-bar.js rewrites the native `title` to `data-desktop-tooltip` and
mirrors it to `aria-label` so the OS-delayed native tooltip never
competes with a CSS `::after` pseudo-element rendering the dark pill
underneath. The tooltip on the keyboard-shortcuts anchor is
suppressed while its popover is open so the two never stack.

Reorder the secondary admin-bar entries by purpose. Left to right:
Switch to Classic Admin (mode toggle, escape hatch), Fullscreen and
Arrange (shell-state cluster), Ask AI (primary action, central),
Keyboard shortcuts and Report a bug (help/meta cluster, anchored next
to the user identity menu — matches the convention most SaaS products
use for Help / "?" near the user-menu corner).
…gate arrows

Every `<wpd-*>` component attaches an open shadow root. When focus
lands on an inner `<input>` or `<textarea>`, `document.activeElement`
returns the host element, not the leaf — `instanceof HTMLInputElement`
returned `false` and the gate classified the host as non-text. Bare
backtick and the new arrow-key desktop shortcuts then fired while the
user was typing into shell-side inputs (OS Settings AI tab API-key
input, Plugins window search box, Open URL dialog, etc.).

Walk through each open shadow root's own `activeElement` before the
existing INPUT / TEXTAREA / contenteditable checks. Closed shadow
roots stop the walk on their own (their `activeElement` is `null`
from outside). The iframe / Gutenberg case is unaffected — focus
lands on the `<iframe>` element itself, caught by the existing
`HTMLIFrameElement` branch.

Tighten the `isContentEditable` access for the new `Element | null`
typing (`el instanceof HTMLElement && ...`).

Adds three vitest cases: single-level shadow input (positive),
two-level nested shadow textarea (positive, walks the chain), button
inside shadow (negative — still respects element type).
@epeicher epeicher enabled auto-merge (squash) May 15, 2026 15:53
@github-actions
Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@epeicher epeicher merged commit bc404cf into trunk May 15, 2026
5 checks passed
@epeicher epeicher deleted the feat/admin-bar-redesign-and-shadow-text-entry-fix branch May 15, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant