Title: fix(sidebar): stop the workspace switcher stranding a phantom hover by waleedlatif1 · Pull Request #6096 · simstudioai/sim · GitHub
Open Graph Title: fix(sidebar): stop the workspace switcher stranding a phantom hover by waleedlatif1 · Pull Request #6096 · simstudioai/sim
X Title: fix(sidebar): stop the workspace switcher stranding a phantom hover by waleedlatif1 · Pull Request #6096 · simstudioai/sim
Description: The report In the workspace switcher, a row keeps a hover-looking highlight after the pointer has moved away — so two rows appear hovered at once (the selected workspace, plus a stale one). Cause Not a hover at all. #5893 added keyboard navigation to the switcher, tracked by highlightedId. Three things combine: highlightedId is set from onMouseMove (workspace-header.tsx:578) — deliberately, since mouseenter would hijack the keyboard selection when scrollIntoView slides rows under a stationary cursor. Nothing clears it on the way out. There is no onMouseLeave in the file; it only resets when the whole menu closes. It paints via chipVariants({ active }), and in chip.tsx active: true → bg-[var(--surface-active)] while active: false → hover-hover:bg-[var(--surface-active)]. Identical token (#ececec / #2c2c2c). So the last row the pointer crossed keeps a background indistinguishable from hover, forever — next to the equally---surface-active current workspace. It also happens with no hovering at all: the seeding effect (:214) puts the cursor on row 0 at open, so any user whose current workspace isn't first sees two marked rows immediately. Only reachable above WORKSPACE_SEARCH_THRESHOLD (3 workspaces), which is why it went unnoticed. Fix Paint the cursor only while the user is actually navigating by keyboard. Arrow keys enter that mode; any pointer motion leaves it. In pointer mode the only mark is real CSS :hover, which follows the pointer and leaves with it. highlightedId still tracks the pointer, so Enter keeps targeting the row last touched — only whether it's drawn changes. Why this approach It's the pattern this codebase already has: packages/emcn/src/components/popover/popover.tsx tracks isKeyboardNav under the literal comment "Suppress hover when in keyboard mode to prevent dual highlights", and tag-dropdown.tsx consumes it. It matches how Headless UI models a combobox: one modality-driven focus marker (data-focus, "focused via mouse or keyboard") kept separate from data-selected (the current value). The list carries no aria-activedescendant, aria-selected, or listbox/option roles, so the highlight is purely visual and no a11y contract changes. Why not onMouseLeave It's a normal pattern (19 files use it) but the wrong tool here, and it wouldn't work: the seeding effect at :214 re-seeds highlightedId to filteredWorkspaces[0] whenever the current one is absent, so clearing to null bounces the highlight to row 1 rather than removing it. It would also silently retarget Enter (activeIndex falls back to 0), do nothing for the on-open case, and fire spuriously when a row's ... menu portals out. Testing New workspace-header.test.tsx with 4 tests, deliberately rendering the real @sim/emcn — mocking chipVariants would only assert the stub. All three highlight tests were verified to fail without the fix and pass with it. Two fixture details that matter: The current workspace is intentionally not first, or the row-0 seed masks the on-open double-mark (an earlier draft passed while broken because of this). isMarked matches an exact class token, never a substring — hover-hover:bg-[var(--surface-active)] contains the active class, so a substring check reports every row as marked.
Open Graph Description: The report In the workspace switcher, a row keeps a hover-looking highlight after the pointer has moved away — so two rows appear hovered at once (the selected workspace, plus a stale one). Cause N...
X Description: The report In the workspace switcher, a row keeps a hover-looking highlight after the pointer has moved away — so two rows appear hovered at once (the selected workspace, plus a stale one). Cause N...
Opengraph URL: https://github.com/simstudioai/sim/pull/6096
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:5f5f22fc-39a9-18f9-4531-3cd84a4085e1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B6F0:EE197:B6594A:F9C0CC:6AFB539C |
| html-safe-nonce | 7cac0893dcaab9cef5c5a038131618b3b835c591c1d2d66b11ee94c13f52fa2d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkYwOkVFMTk3OkI2NTk0QTpGOUMwQ0M6NkFGQjUzOUMiLCJ2aXNpdG9yX2lkIjoiMjYzMDA4MTQwNTEyNzQ0NzQ1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c768e641d2020ec2575da11b2479a7b916ab4282e6b08ea514839b555cb65e16 |
| hovercard-subject-tag | pull_request:4172050501 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6096/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | The report In the workspace switcher, a row keeps a hover-looking highlight after the pointer has moved away — so two rows appear hovered at once (the selected workspace, plus a stale one). Cause N... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width