Repository navigation
fix(sidebar): give an asked-for filter's focus to a row that takes it, and keep it open for the sidebar's own menus - #2141
Merged
Conversation
…, and keep it open for a row's menu Follow-up to #2073 (closes #2079): - Close filter and Escape return the focus to what opened the field, else to the first row control that is drawn and takes it (a desktop draws no row ⋯, and a workspace row is a div[role=button]); each candidate is checked to hold the focus. - A row's menu or sheet, drawn outside the sidebar, counts as the sidebar for the field's outside-press and focus-out handling. - The deferred blur check is cancelled when the field stops being closable or unmounts, and rechecks that the field is still empty; a press from before the field opened no longer suppresses its first blur. - scripts/sidebar-declutter-demo-regression.ts covers the three cases on a desktop.
Codex review of the previous commit: every .row-menu on the page counted as the sidebar, so a tab's menu kept the empty asked-for filter open. RowMenu now records each open menu's button (rowMenuAnchor), and the sidebar counts a menu as its own only when that button is inside it. The regression also checks that a tab's menu takes the field, and that an empty field's blur to nowhere takes it right after the press that closed it last (the pressedInside reset).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 14 minutes. View limit details
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 |
Owner
Author
|
Merging fe5a42e: omo-native-code-reviewer and Codex both pass this head, and the required checks are green, including the sidebar browser regression. CodeRabbit did not review this head. The LOW notes go to a follow-up issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2079 (follow-up to #2073).
What it fixes for the user
With Settings → Appearance → Sidebar filter off, the command palette's Filter workspaces and agents opens the
filter field for a filter's time. Three edges of that field were still broken on main:
Settings switch, after turning the setting off while the field held words), Close filter / Escape fell back to
the list's first
button. That skipped the workspace row itself (adiv[role=button]) and landed on the row's⋯, which a desktop does not draw, so the focus stayed on
<body>. Now it tries the opener, then each rowcontrol that is drawn, not inert and takes the focus, and checks that the focus actually landed before stopping.
from the keyboard closed the empty field (and the menu was then drawn one row out of place), and a click on a
menu item closed the field before the click landed. Now the sidebar counts a menu or sheet as its own when the
menu's button is inside it:
RowMenurecords each open menu's button (rowMenuAnchor). A tab's menu, or anyother one, still takes the empty field, as before.
frame is now cancelled when the field stops being closable or unmounts, and it rechecks that the field is still
empty. Also, a press from the field's last close no longer makes its next blur ignored (
pressedInsideis resetwhen the field opens).
Design: the focus return follows the same pattern as
useFocusTrap's return (lib/useFocusTrap.ts) and theWAI-ARIA dialog practice, which VS Code's and Zed's quick-pick filters also follow: focus goes back to the opener,
or to the nearest sensible control, never to the document.
Tests
scripts/sidebar-declutter-demo-regression.tsgets a desktopfilterEdgescase (a newflat=1fixture paramtakes the worktrees off the demo's workspaces, so a row's first button is its undrawn ⋯):
<body>);(fails on main);
pressedInsidereset);.row-menucounted as the sidebar);Each case was checked failing with its fix reverted and passing with it. The full script passes (desktop and
phone, light and dark).
bun run check fastis green.Reviews
could pass without its fix). Both fixed in fe5a42e; re-review PASS with no findings.