Skip to content

[Fix] handle searchBar focus on mergeOptions for existing searchController#8319

Open
IsaacIsrael wants to merge 2 commits into
wix:masterfrom
IsaacIsrael:fix/searchbar-focus-on-merge-options
Open

[Fix] handle searchBar focus on mergeOptions for existing searchController#8319
IsaacIsrael wants to merge 2 commits into
wix:masterfrom
IsaacIsrael:fix/searchbar-focus-on-merge-options

Conversation

@IsaacIsrael
Copy link
Copy Markdown
Contributor

Summary

  • When mergeOptions is called with topBar.searchBar.focus: true on a screen whose searchController already exists, the focus was silently ignored — the becomeFirstResponder logic only ran in the initial-creation branch
  • Adds focus handling in the else branch so the search bar refocuses on existing search controllers (e.g., when switching back to a bottom tab)

Fixes #8318

Test plan

  1. Register a bottom-tab screen with searchBar: { visible: true, focus: true }
  2. Mount the screen — verify search bar auto-focuses
  3. Switch to a different tab, then switch back
  4. Call Navigation.mergeOptions(componentId, { topBar: { searchBar: { visible: true, focus: true } } }) on componentDidAppear
  5. Verify the search bar re-focuses on return

Made with Cursor

…ontroller

When calling mergeOptions with searchBar.focus: true on a screen that
already has a searchController, the focus was silently ignored because
the focus logic only ran in the initial creation branch.

This adds focus handling in the else branch so becomeFirstResponder is
called on existing search controllers, enabling re-focus on screen
reappear (e.g. switching back to a bottom tab).

Fixes wix#8318

Co-authored-by: Cursor <cursoragent@cursor.com>
@IsaacIsrael IsaacIsrael changed the title fix(ios): handle searchBar focus on mergeOptions for existing searchController [Fix] handle searchBar focus on mergeOptions for existing searchController Jun 1, 2026
Copy link
Copy Markdown
Contributor

@yedidyak yedidyak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I added a focused iOS regression test that verifies mergeOptions refocuses an existing search controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] searchBar focus: true ignored on mergeOptions when searchController already exists

2 participants