Skip to content

Refresh the examples browser UI#257

Merged
willeastcott merged 1 commit into
mainfrom
refresh-examples-browser
Jul 2, 2026
Merged

Refresh the examples browser UI#257
willeastcott merged 1 commit into
mainfrom
refresh-examples-browser

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

What changed

A visual and functional refresh of the examples browser (examples/index.html + css/browser.css + js/*.mjs):

  • Dark PlayCanvas-branded theme built on CSS custom properties: near-black surfaces (#121212 / #1a1a1a), PlayCanvas orange (#f60) accent, themed scrollbars, :focus-visible outlines, dark QR dialog (the QR image sits on a white tile so it stays scannable), dark hamburger/drawer on mobile, and matching PWA manifest / theme-color meta.
  • Search: new search box filters by example name or category. / focuses it from anywhere, Esc clears (then blurs), Enter loads the first match, empty categories hide, and a "No examples found" state covers zero matches.
  • Category grouping: the sidebar is grouped into 8 sections (Graphics, Animation, Physics, Sound, UI & Text, Gaussian Splatting, XR, Showcases). Ad-hoc name prefixes ("Splat:", "UI:", "Game:") are dropped now that group headers give context. Paths are unchanged, so existing deep links keep working.
  • Two examples added to the list that existed on disk but were never listed: AR Hand Gestures and 2D Screen (27 total). The three spinning-cube getting-started variants remain unlisted but reachable by URL, as before.

Bugs fixed along the way

  • Back/forward desync: setting iframe.src pushed iframe navigations into the joint browser history, interleaved with the pushState hash entries — so Back rewound the iframe while the sidebar/hash stayed put. The iframe now navigates via location.replace(), which keeps history to hash entries only; Back/Forward now keeps the URL, active row, and iframe in sync. The initial URL update also uses replaceState so the first Back press isn't dead.
  • Mobile overlay never worked: .sidebar-overlay had no CSS (zero-size div), so tapping outside the drawer couldn't close it. Now styled and functional.
  • QR dialog listener leak: a new backdrop-click handler was attached on every open; now attached once.
  • Arrow-key navigation now walks only visible (unfiltered) links and is safe with zero results.

Notes for reviewers

  • The default landing example (no hash) is now Basic Shapes (first entry after the category reorder) instead of Animation — trivially adjustable via group order if undesired.
  • The active row is white-on-#f60 (~2.9:1 contrast, consistent with the previous UI and playcanvas.com). If AA contrast is preferred, the alternative is orange text on an orange tint.
  • Verified locally: deep links (including both new examples and bogus-hash fallback), all search/keyboard behaviors, history round-trips, QR modal repeated open/close, mobile drawer at 375x812, and npm run lint.

🤖 Generated with Claude Code

Modernize the examples browser with a dark PlayCanvas-branded theme and
better navigation:

- Dark theme built on CSS custom properties (#121212/#1a1a1a surfaces,
  #f60 accent), themed scrollbars, focus-visible outlines, dark QR
  dialog (QR kept on a white tile for scannability) and dark PWA colors
- Search box that filters by example name or category (/ focuses, Esc
  clears, Enter loads the first match)
- Sidebar grouped into 8 categories (Graphics, Animation, Physics,
  Sound, UI & Text, Gaussian Splatting, XR, Showcases); redundant name
  prefixes dropped now that headers give context
- Add missing AR Hand Gestures and 2D Screen examples (27 total)
- Fix back/forward desync: navigate the iframe via location.replace()
  so it no longer pushes interleaved history entries, and replaceState
  on the initial load so the first Back press is not dead
- Fix mobile overlay: .sidebar-overlay had no CSS so tapping outside
  the drawer never closed it
- Fix QR dialog attaching a new backdrop-click listener on every open
- Arrow-key navigation now walks only visible (unfiltered) links

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@willeastcott willeastcott merged commit 8019cd7 into main Jul 2, 2026
2 checks passed
@willeastcott willeastcott deleted the refresh-examples-browser branch July 2, 2026 15:42
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