Skip to content

feat(inspector): modernize toolbar and inspector UX and improve performance metrics - #304

Merged
dermatz merged 10 commits into
mainfrom
feature/modernize-toolbar-inspector-ux
Dec 1, 2026
Merged

dermatz merged 10 commits into
mainfrom
feature/modernize-toolbar-inspector-ux

Conversation

@dermatz

@dermatz dermatz commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Unifies and modernizes the MageForge Toolbar and Frontend Inspector into a single cohesive, Linear/Vercel-inspired in-browser DevTools Dock & Panel (including a live Main-Thread & Vitals Profiler) while keeping the existing Alpine.js + ES Module + Magento View architecture intact.

Previously, Toolbar and Inspector operated as two visually separate overlays with duplicated CSS variables, mixed emojis/SVGs, light-DOM style bleeding from shop themes, and a large hover tooltip that jumped across page content. Both now share a single design system and strict storefront CSS isolation so MageForge looks identical across Luma (62.5% root font-size), Blank, Hyvä (@tailwindcss/forms / preflight), and custom storefronts.

Key UX & Architecture Improvements

  • Unified DevTools Dock Capsule: Single obsidian-glass floating pill combining the MageForge panel trigger, Element Inspector picker, Page Block count shortcut, live Health Score chip, and a 1-click Clear Highlights action when audits or selections are active.
  • Floating Popover & Docked Right Drawer: Toggle seamlessly between an anchored popover and a full-height right-side DevTools sidebar (data-panel-mode="docked") so storefront content stays unobstructed during block inspection and audit review.
  • Non-Intrusive Hover-HUD + Unified Inspector Tab:
    • Picking elements on the storefront displays a compact, pointer-transparent Hover-HUD pill (<tag.class>, dimensions, render time, override/cache pills, template path, module/alias) with viewport-fixed highlights.
    • Clicking an element locks the selection and opens its full telemetry (Structure + Open in IDE + 1-Click Override, Accessibility, Cache, Web Vitals) inside the unified Inspector tab, with crisp SVG icons throughout.
  • Interactive Block/DOM Breadcrumbs & Keyboard Stepping: Walk parent/child Magento blocks and DOM nodes via clickable breadcrumb chips (including Magento layout parent alias resolution) or ArrowUp / ArrowDown keys.
  • Page Block & Template Explorer (Blocks Tab): Searchable, indented tree of all rendered [data-mageforge-id] blocks on the current page with instant filter pills (All, Overrides, No Cache, Slow >50ms), live hover preview highlighting, and 1-click selection.
  • Live Main-Thread & Core Web Vitals Profiler (Profiler Tab + Main-Thread Blockers Audit):
    • Native PerformanceObserver telemetry for Total Blocking Time (TBT), Long Tasks (> 50 ms), and Chromium Long Animation Frames (long-animation-frame / LoAF) with culprit script URL, function name, invoker, and forced style/layout reflow duration (automatically excluding MageForge internal assets and audit runs).
    • Real Render-Blocking Resources via ResourceTiming.renderBlockingStatus === "blocking" (CSS/JS/Fonts with size & duration).
    • Official INP / Slow User Interactions (interactionId > 0) with 3-phase breakdown (Input Delay · Processing · Presentation) and 1-click Inspect handoff to the target Magento template.
  • Audit-to-Inspector Handoff & Category Filtering: Every audit category now includes a live search filter + Issues only toggle, and every finding row features a 1-click Inspect button that jumps straight to the .phtml template and Magento block responsible for that DOM node.
  • Unified Settings Hub (Settings Tab): Centralizes browser-persisted preferences for panel layout (Floating / Right Drawer), dock corner, dock labels, default target override theme, IDE preset & Docker/DDEV host-path mappings, and keyboard shortcuts.
  • Strict Shop-CSS Isolation: Scoped resets with pixel-based sizing (px instead of rem) and semantic --mageforge-* custom properties across Dark, Light, and Auto themes.

Verification

  • trunk fmt && trunk check (Prettier, markdownlint, svgo, git-diff-check)
  • ddev phpcs (including CSS/JS sniffs across 211 files)
  • ddev phpstan (Level 9)
  • ddev mago lint && ddev mago fmt --check && ddev mago analyze
  • ddev exec vendor/bin/phpunit (904 tests, 2636 assertions)
  • Verified interactively in browser against DDEV Magento storefront (Floating vs. Docked Sidebar, Dark/Light/Auto themes, Hover-HUD, Breadcrumbs, Block Explorer, Main-Thread/LoAF/INP Profiler, Audits, and Inspect handoff)

Consolidate the separate Toolbar and Frontend Inspector UIs into a single CSS-isolated DevTools dock and panel that renders identically across Luma, Hyva, and custom Magento themes.

- Add unified floating dock capsule with quick triggers for DevTools, Element Inspector, Page Block Explorer, Health Score, and 1-click highlight reset
- Support switching between a floating popover and a docked right-side drawer in Dark, Light, and Auto colour schemes
- Replace jumping multi-tab hover badges with a compact non-intrusive Hover-HUD pill, viewport-fixed highlights, interactive layout/DOM breadcrumbs, and keyboard parent/child stepping
- Add searchable Page Block & Template Explorer and 1-click Inspect handoff from audit findings straight to the underlying template
- Centralize layout, dock, target theme, and IDE host-path settings while strictly isolating typography, buttons, and form controls from storefront stylesheets

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 09:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active issues can select the wrong element, overwrite live settings or unsaved edits, and leave keyboard focus outside the floating panel when it opens.

5 open issues
What changed in this PR

Unifies MageForge’s toolbar and frontend inspector into a shared DevTools dock and panel while retaining the existing Alpine.js and ES module architecture.

Changes:

  • Adds floating and docked layouts, a searchable block explorer, and unified preferences.
  • Connects audit findings to element inspection, with compact hover details and parent/child navigation.
  • Refreshes shared design tokens, component styling, responsive layouts, and storefront CSS isolation.
File Description
src/​view/​frontend/​web/​js/​toolbar/​ui/​settings.js Adds unified layout, IDE, and override settings.
src/​view/​frontend/​web/​js/​toolbar/​ui/​score.js Synchronises dock scores and category gauges.
src/​view/​frontend/​web/​js/​toolbar/​ui/​items.js Adds finding-to-inspector actions.
src/​view/​frontend/​web/​js/​toolbar/​ui/​controls.js Manages panel modes, focus, and preferences.
src/​view/​frontend/​web/​js/​toolbar/​ui/​constants.js Updates shared SVG icons.
src/​view/​frontend/​web/​js/​toolbar/​ui/​blocks.js Adds searchable block exploration and selection.
src/​view/​frontend/​web/​js/​toolbar/​ui.js Registers settings and block-explorer methods.
src/​view/​frontend/​web/​js/​toolbar/​audits/​tab-order.js Excludes inspector controls from tab-order audits.
src/​view/​frontend/​web/​js/​toolbar/​audits/​highlight.js Excludes inspector elements from audit highlighting.
src/​view/​frontend/​web/​js/​toolbar/​audits/​createAudit.js Filters DevTools elements from detection results.
src/​view/​frontend/​web/​js/​toolbar.js Coordinates dock state and inspector events.
src/​view/​frontend/​web/​js/​inspector/​tabs.js Renders inspector tabs in the unified panel.
src/​view/​frontend/​web/​js/​inspector/​picker.js Updates selection, hover, and keyboard stepping.
src/​view/​frontend/​web/​js/​inspector/​performance.js Refreshes cache and performance displays.
src/​view/​frontend/​web/​js/​inspector/​ide.js Integrates IDE controls with the unified view.
src/​view/​frontend/​web/​js/​inspector/​accessibility.js Refreshes accessibility metadata presentation.
src/​view/​frontend/​web/​js/​inspector.js Connects inspector lifecycle and toolbar events.
src/​view/​frontend/​web/​css/​toolbar/​_variables.css Defines shared semantic design tokens.
src/​view/​frontend/​web/​css/​toolbar/​_themes.css Applies shared light and automatic themes.
src/​view/​frontend/​web/​css/​toolbar/​_responsive.css Adapts the dock and panel for narrow screens.
src/​view/​frontend/​web/​css/​toolbar/​_reset.css Adds scoped resets against storefront styles.
src/​view/​frontend/​web/​css/​toolbar/​_positions.css Styles dock corners and the right-side drawer.
src/​view/​frontend/​web/​css/​toolbar/​_menu.css Restyles the panel, filters, and audit rows.
src/​view/​frontend/​web/​css/​toolbar/​_jsonld-viewer.css Adopts semantic viewer colours and typography.
src/​view/​frontend/​web/​css/​toolbar/​_health.css Refreshes health gauges and score rings.
src/​view/​frontend/​web/​css/​toolbar/​_groups.css Styles navigation, dashboard, blocks, and settings.
src/​view/​frontend/​web/​css/​toolbar/​_footer.css Refreshes footer and segmented controls.
src/​view/​frontend/​web/​css/​toolbar/​_findings.css Styles Locate and Inspect finding actions.
src/​view/​frontend/​web/​css/​toolbar/​_feedback.css Updates feedback toast styling.
src/​view/​frontend/​web/​css/​toolbar/​_credit.css Refreshes footer attribution styling.
src/​view/​frontend/​web/​css/​toolbar/​_buttons.css Consolidates action-button styles.
src/​view/​frontend/​web/​css/​toolbar/​_burger.css Styles the unified dock capsule and indicators.
src/​view/​frontend/​web/​css/​audits/​tab-order.css Uses the shared shadow token.
README.md Documents the unified DevTools features.

Review effort: Balanced

Comment thread src/view/frontend/web/js/inspector.js Resolved
Comment thread src/view/frontend/web/js/toolbar.js Resolved
Add the official MageForge website link alongside GitHub and Feedback in the DevTools footer and remove the redundant Pick Element button from the Page Overview health card.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved regressions can select the wrong element, discard settings changes, and make floating panels inaccessible to keyboard users or off-screen on mobile.

5 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Match floating selector specificity in the mobile override

src/​view/​frontend/​web/​css/​toolbar/​_responsive.css:46

On viewports at or below 680 px, a floating panel in either top corner retains top: calc(100% + 10px) from _positions.css: that selector includes :not([data-panel-mode="docked"]) and has higher specificity than this mobile override. Since the mobile rule makes the panel fixed, that percentage is now relative to the viewport, placing the panel below the screen. Match the floating selector's specificity so top: 56px actually wins.

Medium severity Strip thousands separators before parsing render times

src/​view/​frontend/​web/​js/​toolbar/​ui/​blocks.js:57

The server serialises render times with number_format(..., 2) in BlockCacheCollector::formatMetricsForJson(), so a 1,234.56 ms render arrives as "1,234.56". parseFloat() reads that as 1, displaying 1.0 ms and excluding this very slow block from the Slow filter. Remove thousands separators before parsing.

Review effort: Balanced

Add a live Browser Performance & Main-Thread Profiler tab under Workspace plus a Main-Thread Blockers audit check in the Performance category.

- Collect Long Tasks (>50 ms), Total Blocking Time (TBT), and Chromium Long Animation Frames (LoAF) script/function/invoker and forced-reflow attribution while filtering out MageForge internal scripts and batch audit scans
- Track official Web Vitals INP discrete interactions (interactionId > 0) with Input Delay / Processing / Presentation phase breakdown and 1-click Inspect handoff to the target Magento template
- List actual render-blocking CSS/JS/font requests via ResourceTiming.renderBlockingStatus alongside live LCP, CLS, TTFB, and FCP KPIs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…lexity

- Move focus into the floating panel on open, filter hidden tab panels from focusable controls, and restore focus to the trigger on Escape
- Preserve unsaved Settings IDE inputs when switching target override theme and sync settings via event payloads without self-overwriting in-memory state
- Resolve fresh click targets during picker debounce unless stepped via keyboard and clear stale non-descendant childStepStack entries
- Decompose complex Inspector, Settings, Audit, and Profiler helpers to satisfy CodeFactor complexity and dead-store checks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:40
…specificity

- Match desktop floating panel CSS specificity in mobile responsive overrides so top-left and top-right panels anchor at top: 56px
- Track MageForge-only LoAF intervals and full frameDuration bounds when deduplicating overlapping longtask entries
- Compute CLS via Web Vitals max session windows (1s gap, 5s span) and p98 INP across worst retained interactions
- Strip thousands separators from formatted block renderTime strings before parsing in Block Explorer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Copilot AI balanced review requested due to automatic review settings December 1, 2026 10:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Docked mode removes the only Escape-key listener, preventing the right drawer from closing with Esc when the picker is inactive.

2 open issues
2 resolved since last review

Review effort: Balanced

… AJAX monitor

- Add stacked TTFB & navigation waterfall (Redirects, DNS/TLS, Backend/FPC Wait, HTML Download, HTTP protocol, HTML payload, and Server-Timing headers)
- Add Google 4-part LCP phase breakdown (TTFB, Resource Load Delay, Resource Load Duration, Element Render Delay) with lazy/fetchpriority flags and Magento .phtml block attribution
- Map Layout Shift (CLS) source elements with pixel deltas (dX/dY) directly to enclosing Magento blocks with hover highlight and 1-click Inspector handoff
- Add live runtime monitor for Magento customer-data, GraphQL, REST, Checkout, and 3rd-party XHR/Fetch requests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:02
…trols

- Handle Escape panel dismissal globally when picker is inactive so both floating and docked panels close consistently
- Limit findings container key propagation guard to Enter and Space so Escape and Tab bubble to panel-level focus management

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved keyboard and focus regressions break drawer closing and inspector interactions, while missing CLS attribution can falsely report that the page stayed stable.

4 open issues
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Pinned selections incorrectly intercept storefront arrow keys outside the Inspector, while empty culprit lists are misreported as zero CLS even when attribution or API support is unavailable.

4 open issues

Review effort: Balanced

…appings

- Add HostPathDetector service to resolve host Magento root and extra bind-mount mappings from /mnt/ddev_config/.ddev-docker-compose-full.yaml (supporting both DDEV bind mounts and Mutagen com.ddev.approot labels, plus MAGEFORGE_HOST_ROOT override)
- Expose data-detected-host-root and data-detected-external-mappings on the Inspector block and use them as automatic defaults while keeping browser localStorage persistence unchanged
- Prioritize nested container bind-mount mappings before generic root prefix fallback so sub-mounts inside BP resolve to their host source paths
- Add unit tests for HostPathDetector and Inspector block memoization

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:33
@github-actions github-actions Bot added the Config label Dec 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Active findings identify incorrect Open in IDE paths for nested mounts, Mutagen projects, and multi-service Compose configurations, plus a misleading CLS message when no source nodes are attributable.

7 open issues

Review effort: Balanced

…tion and keyboard UX

- Scope DDEV compose parsing to services.web and use named volume targets for Mutagen approot fallback so subdirectory setups preserve their Magento suffix
- Include the Magento root->hostRoot pair in longest-prefix path resolution so ancestor external mappings cannot override nested Magento mounts
- Restrict non-picker ArrowUp/ArrowDown stepping to DevTools focus and preserve keyboard-stepped hover until the raw pointer target changes
- Transfer focus when the currently focused menu control lies inside a hidden inactive tab panel and distinguish non-zero unattributed CLS from zero CLS

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- Restrict volume-based DDEV approot fallback candidates to container targets that equal or contain Magento's root path so nested shadow volumes (such as mageforge-source/magento) are never recorded as project-root mappings
- Cover default zero-argument detect() calls in HostPathDetectorTest

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because the new copy controls lack keyboard access and closing the panel can leave focus on a hidden element.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@dermatz dermatz changed the title feat(inspector): unify and modernize toolbar and inspector UX feat(inspector): modernize toolbar and inspector UX and improve performance metrics Dec 1, 2026
@dermatz
dermatz merged commit 11a8191 into main Dec 1, 2026
22 of 23 checks passed
@dermatz
dermatz deleted the feature/modernize-toolbar-inspector-ux branch December 1, 2026 12:22
@github-actions github-actions Bot mentioned this pull request Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants