Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Given a query, after refresh, searchBox cursor jumps at the begining of the input #946

Closed
powtac opened this issue Mar 22, 2016 · 6 comments

Comments

@powtac
Copy link

powtac commented Mar 22, 2016

When having autofocus: true in the searchBox widget and urlSync activated in the instantsearch, the search box is populated with the previous search query after a reload happens and the cursor is placed (with focus()?) into the search box input field.

unbenannt

In this case I would expect that the cursor is placed at the end of the query and not at the beginning.

@vvo
Copy link
Contributor

vvo commented Mar 22, 2016

Yes indeed this looks like a bug, can you give me:

  • browser
  • browser version
  • system

Thanks

@powtac
Copy link
Author

powtac commented Mar 22, 2016

  • Firefox 45.0.1
  • Internet Explorer 11
  • Windows 7

@vvo
Copy link
Contributor

vvo commented Mar 22, 2016

I am not able to reproduce this on a simple example so it might be one of your scripts conflicting with our input. I would recommend you to double check everywhere you may be or a script may be doing an autofocus the wrong way.

@powtac
Copy link
Author

powtac commented Mar 22, 2016

Sure! Could be the case, I will investigate soon.


BTW Firebug for Firefox has an "Events" section at the right, beside "Styles, Layout, DOM", when you have selected a element in the HTML view.

events

This should give the answer...

@vvo
Copy link
Contributor

vvo commented Mar 22, 2016

BTW Firebug for Firefox has an "Events" section at the right, beside "Styles, Layout, DOM", when you have selected a element in the HTML view.

Yes I guess you will be able to find the bad event maybe from here, otherwise just remove some of the JS scripts from your page and see when it stops doing bad things

@vvo
Copy link
Contributor

vvo commented Jun 13, 2016

Just reproduced this on the current develop branch:

  • search for smg
  • refresh

Cursor is at the begining.

Most probably because we fill the query field AFTER autofocus has triggered.

@vvo vvo changed the title Placing cursor at the end of search query? Given a query, ippon refresh, searchBox cursor is at the begining of the input Jun 13, 2016
@vvo vvo added the urlSync label Jun 13, 2016
@vvo vvo changed the title Given a query, ippon refresh, searchBox cursor is at the begining of the input Given a query, after refresh, searchBox cursor jumps at the begining of the input Jun 13, 2016
@vvo vvo self-assigned this Jul 6, 2016
@vvo vvo closed this as completed in 8a27769 Jul 11, 2016
vvo pushed a commit that referenced this issue Jul 11, 2016
<a name="1.6.2"></a>
## [1.6.2](v1.6.1...v1.6.2) (2016-07-11)

### Bug Fixes

* **paginationLink:** it's aria-label not ariaLabel (#1125) ([70a190c](70a190c))
* **pricesRange:** fill the form according to the current refinement (#1126) ([12ebde7](12ebde7)), closes [#1009](#1009)
* **rangeSlider:** handles now support stacking (#1129) ([ad394d3](ad394d3))
* **rangeSlider:** use stats min/max when only user min or max is provided (#1124) ([4348463](4348463)), closes [#1004](#1004)
* **searchBox:** force cursor position to be at the end of the query (#1123) ([8a27769](8a27769)), closes [#946](#946)
* **searchBox:** IE8, IE9 needs to listen for setQuery ([97c166a](97c166a))
* **searchBox:** update helper query on every keystroke (#1127) ([997c0c2](997c0c2)), closes [#1015](#1015)
* **urlSync:** urls should be safe by default (#1104) ([db833c6](db833c6)), closes [#982](#982)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants