Skip to content

SearchBox widget does not sync with router (browser forward/back) if input is focussed #6621

Open
@Njitram2000

Description

@Njitram2000

🐛 Current behavior

When the browser history (forward/back) is used after searching and the input field is still focussed, the url and search results update but the searchBox widget input field does not get the new value.

🔍 Steps to reproduce

Copy the shared code html file to a dedicated file locally. You cannot reproduce this in codesandbox because the integrated forward/back force the input field to lose focus.

  1. search for something and wait for the url to update
  2. type an extra letter and wait for the url to update
  3. The input field should remain focused
  4. Use your mouse buttons or alt+arrow to go back
  5. The url has gone back to the first search but the input field has remained the same

Live reproduction

https://codesandbox.io/p/sandbox/confident-stitch-6c4dzj

💭 Expected behavior

The input field should update with the router, even if it is focused

Package version

algoliasearch 5.10.2, instantsearch.js 4.75.3

Operating system

windows 11

Browser

Firefox 137 and chrome 134

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageIssues to be categorized by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions