Skip to content

fix(split-layout): skip search bar on H/L focus restoration#2791

Merged
gbirman merged 1 commit into
mainfrom
macro-czkTdSCTrF5NPKyeLw1zk-search-bar-should-not-take-focus-unless-specified-by-click-or-hot-key
Apr 23, 2026
Merged

fix(split-layout): skip search bar on H/L focus restoration#2791
gbirman merged 1 commit into
mainfrom
macro-czkTdSCTrF5NPKyeLw1zk-search-bar-should-not-take-focus-unless-specified-by-click-or-hot-key

Conversation

@gbirman
Copy link
Copy Markdown
Contributor

@gbirman gbirman commented Apr 23, 2026

Summary

  • The split focus tracker records the last-focused child per split and refocuses it when the split is re-activated via Shift+H/L. The search bar auto-focuses on mount, so it got recorded as the split's last-focused child — every H/L back into the search split yanked focus into the search input.
  • Add a generic data-no-focus-restore opt-out on the split tracker and apply it to the search bar wrapper. Explicit focus paths (click, Cmd+F, / hotkey, mount-time autoFocus) still work; H/L split navigation no longer restores focus to the search bar.

The split focus tracker records the last focused child in each split
and refocuses it when the split is re-activated via Shift+H/L. Because
the search bar auto-focuses on mount, it got recorded as the last
focused child, so every H/L back into the search split yanked focus
into the search input.

Add a generic `data-no-focus-restore` opt-out and apply it to the
search bar wrapper. Explicit focus paths (click, Cmd+F, / hotkey,
mount-time autoFocus) still work; H/L split navigation no longer
restores focus to the search bar.
@macro-application
Copy link
Copy Markdown

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7a4f00f-6871-4b7e-beee-015250f6a0f3

📥 Commits

Reviewing files that changed from the base of the PR and between 8f43fe4 and 98b3387.

📒 Files selected for processing (2)
  • js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx
  • js/app/packages/app/component/split-layout/SplitLayout.tsx

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved focus management behavior in the layout system to prevent unintended focus restoration in search contexts.

Walkthrough

The changes implement a focus restoration exclusion mechanism for split layouts. A data-no-focus-restore attribute marks elements to be excluded from focus tracking, while the split layout's focus tracker is updated to detect and skip such marked subtrees.

Changes

Cohort / File(s) Summary
Focus restoration control
js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-search-bar.tsx, js/app/packages/app/component/split-layout/SplitLayout.tsx
Introduces data-no-focus-restore attribute to exclude elements from focus restoration. Search bar wrapper now marked with attribute; split layout focus tracker conditionally skips recording focus for elements within marked subtrees.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the conventional commits format with 'fix:' prefix and clearly describes the main change of preventing search bar focus restoration during H/L split navigation.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation for the fix and how the data-no-focus-restore attribute solves the problem of unwanted focus restoration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

@gbirman gbirman requested a review from sedson April 23, 2026 15:57
@gbirman gbirman merged commit dc72485 into main Apr 23, 2026
24 checks passed
@gbirman gbirman deleted the macro-czkTdSCTrF5NPKyeLw1zk-search-bar-should-not-take-focus-unless-specified-by-click-or-hot-key branch April 23, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant