Ios Sim Inspect Stays Active - #667
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
arul28
commented
Jun 29, 2026
@copilot review but do not make fixes |
📝 WalkthroughWalkthrough
ChangesInspect hover priority fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Describe the change.
What Changed
Key files and behaviors.
Validation
How you tested.
Risks
Anything to watch.
Summary by CodeRabbit
Greptile Summary
This PR fixes a bug in the iOS Simulator inspect overlay where the highlight box stayed locked to the most recently clicked element instead of following the pointer as the user hovered over different elements. The fix is a single one-line change that reverses operator precedence between
hoveredElementandselectedElement.ChatIosSimulatorPanel.tsxline 2357): flipsselectedElement ?? hoveredElementtohoveredElement ?? selectedElement, so the inspect overlay follows the live hover target and falls back to the selected element only when the pointer leaves the snapshot area.ChatIosSimulatorPanel.test.tsx): adds a scenario that attaches a simulator context, clicks one element, then moves the pointer to a different element and verifies the overlay label updates and the subsequent click targets the new element correctly.Confidence Score: 5/5
Safe to merge — the change is isolated to a single derived-value computation, pointer-leave events still clear hoveredElement so the fallback to selectedElement works correctly, and the new test directly exercises the fixed scenario end-to-end.
The one-line swap is mechanically correct: hoveredElement is already set to null on every onPointerLeave handler, so the fallback to selectedElement is preserved when the cursor leaves the snapshot area. The alt-click parent-selection path in handleInspectClick continues to reference selectedElement directly and is unaffected. The new test confirms both the overlay label update and the pixel coordinates sent to selectPoint after switching hover targets.
No files require special attention.
Important Files Changed
hoveredElement ?? selectedElementreplacesselectedElement ?? hoveredElement— so the inspect highlight follows the pointer while hovering and falls back to the last clicked element when the pointer leaves the surface.selectPoint.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[User moves pointer over snapshot] --> B{hoveredElement set?} B -- Yes --> C[activeInspectElement = hoveredElement] B -- No: pointer left surface --> D{selectedElement set?} D -- Yes --> E[activeInspectElement = selectedElement] D -- No --> F[activeInspectElement = null\noverlay hidden] C --> G[Overlay highlight + label\nfollows pointer] E --> H[Overlay stays on\nlast clicked element] A2[User clicks on element] --> I[selectElementAt called\nsets selectedElement] I --> J[hoveredElement still set\noverlay continues following pointer]%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[User moves pointer over snapshot] --> B{hoveredElement set?} B -- Yes --> C[activeInspectElement = hoveredElement] B -- No: pointer left surface --> D{selectedElement set?} D -- Yes --> E[activeInspectElement = selectedElement] D -- No --> F[activeInspectElement = null\noverlay hidden] C --> G[Overlay highlight + label\nfollows pointer] E --> H[Overlay stays on\nlast clicked element] A2[User clicks on element] --> I[selectElementAt called\nsets selectedElement] I --> J[hoveredElement still set\noverlay continues following pointer]Reviews (1): Last reviewed commit: "Fix iOS simulator inspect hover after at..." | Re-trigger Greptile