feat: polish site frontend audit findings

Merged
MA
5mo ago
+636-395

This PR tightens the site frontend after UX, accessibility, and performance audits.

Highlights:

  • mobile playground layout
  • debounced URL sync
  • tab keyboard handling cleanup
  • main-content focus landing
  • mobile nav dialog semantics/focus improvements

Verification:

  • pnpm --filter @memos-embed/site check
  • pnpm --filter @memos-embed/site build
  • browser verification on mobile and desktop

Summary by cubic

Polishes the site after frontend audits to improve mobile usability, accessibility, and shareable URLs. Adds a live @memos-embed/react hero demo, steadier previews, and better keyboard/focus handling.

  • New Features

    • Mobile playground uses tabs (Preview, Settings, Code); desktop stays side-by-side.
    • Hero card renders a live embed via @memos-embed/react using an in-repo demo memo; default playground memo updated.
    • Debounced, de-duplicated playground URL syncing for clean shareable links; preview updates are throttled.
    • Iframe preview gracefully falls back to a React demo when not configured; preview containers avoid hydration flicker.
  • Bug Fixes

    • Tabs follow WAI-ARIA with roving tabIndex and Arrow/Home/End keys.
    • Mobile nav is a proper dialog (role, aria-modal) with focus trap, Escape to close, restored focus, non-tabbable backdrop, and aria-current on active links.
    • Accessibility polish: html lang derives from the path, “Skip to content” is localized, main content gets focus on load, and reduced-motion disables smooth scrolling.