Repository navigation
feat(explorer): copy quoted and qualified object names - #1077
Conversation
| type="button" | ||
| disabled={item.disabled} | ||
| aria-expanded={open} | ||
| onFocus={() => { |
There was a problem hiding this comment.
WARNING: Keyboard accessibility gap - submenu opens on focus but lacks keyboard navigation
The onFocus handler opens the submenu (lines 148-151), but there's no corresponding keyboard support:
- No
onBlurto close submenu when focus leaves - No ArrowRight/ArrowLeft handling to navigate into/out of submenu
- No Escape handling on the submenu trigger button
- No Tab/Shift+Tab management for focus trapping
This may leave keyboard users unable to close an accidentally opened submenu or navigate into it. Consider adding a onKeyDown handler for ArrowRight (open), ArrowLeft (close), and Escape (close), plus an onBlur with a small delay to close when focus truly leaves the submenu area.
There was a problem hiding this comment.
Good catch. I added ArrowRight, ArrowLeft, and Escape handling, plus closing when focus leaves the submenu. The focused keyboard tests pass in 169f1ae.
Code Review SummaryStatus: 5 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
Files Reviewed (16 files)
Fix these issues in Kilo Cloud Reviewed by free · Input: 236.2K · Output: 7.6K · Cached: 354.2K |
|
The four other copy menus are outside #1042, which covers tables and views. I fixed the keyboard navigation point in the follow-up commit and added tests for focus, Arrow keys, Escape, and blur. |
debba
left a comment
There was a problem hiding this comment.
Hi @CreedTech, thanks for working on #1042! Building on the existing quoteIdentifier / quoteTableRef helpers with activeCapabilities ?? activeDriver keeps the sidebar driver-agnostic, and replacing three inline navigator.clipboard.writeText items with a single builder that uses copyTextToClipboard (with success and error feedback) is a nice cleanup. I really appreciate the extra effort on keyboard access for submenus too: focus to open, ArrowRight/ArrowLeft, and a nested Escape that only closes the flyout, all covered by tests.
Since this is your first PR here: welcome! If you'd like to hang out with us, you're very welcome on our Discord: https://discord.com/invite/K2hmhfHRSt
I'm approving it. A few follow-ups, none of them blocking:
- In
ContextMenu.tsx,scheduleClosenow skips closing whiledocument.activeElementis inside the row. On engines that focus a button on mouse click (Chromium/WebView2 on Windows), clicking the "Copy Name" trigger and then hovering other rows could leave the flyout open until focus moves elsewhere. WKWebView on macOS doesn't focus on click, so it would only show up on Windows/Linux. Worth a quick check there. - The submenu trigger exposes
aria-expandedbut notaria-haspopup="menu". Minor, but cheap to add. - The "Copy Name" entry in the index context menu still uses the raw
navigator.clipboard.writeText(contextMenu.id)without feedback, so it's now a bit inconsistent with tables and views. Could be a small follow-up.
I'll do a manual check on my side before merging.
|
@debba, the remaining review follow-ups are in #1374: pointer-focused submenus close on mouse leave while keyboard focus keeps them open, and copying an index name reports success or failure through the shared clipboard helper. aria-haspopup was already fixed upstream. All 86 tests in the two affected suites pass, with types and source lint clean. The focus case is reproduced in the DOM test; I have not checked Windows/WebView2 manually. |
Fixes #1042
The explorer can now copy a table or view name as plain text, a quoted identifier, or a schema-qualified identifier when a schema is available. It uses the existing quoting helpers for each driver. I also made the submenu open on keyboard focus so the new options are reachable without a mouse.
Checked with
pnpm lint,pnpm run build, and the full Vitest suite (5,862 tests).