Jetpack: Instant Search: Search modal is opened by default in IE11

Created on 9 Mar 2021  Â·  3Comments  Â·  Source: Automattic/jetpack

Steps to reproduce the issue

  1. Visit a site that uses Instant Search in IE11.
  2. As the page finishes loading, the Instant Search modal will be opened by default, even if you have not searched for anything.
Instant Search Search [Pri] Normal [Status] In Progress [Type] Bug

Most helpful comment

I've discerned the cause: IE11 immediately fires an onChange event if the input placeholder contains a Unicode character. Guess what our placeholder for the search input includes?

… <- This.

All 3 comments

Confirmed in Browserstack. The ?s= gets immediately appended to the URL on load, and the modal is opened.

Leaving my notes here for @jsnmoon hands baton

I tracked it down to the onInput handler for the input in SearchBox. You can add some debug to the setSearchQuery action to see it happen.

In most browsers, we see a single setSearchQuery to null when the page loads:

Screen Shot 2021-03-10 at 14 10 10

In IE11, the onInput is unexpectedly fired when the page loads, which leads to setSearchQuery being called with the value "" (which now opens the search modal).

Screen Shot 2021-03-10 at 14 09 44

(The forEach error does not seem related but bears further investigation - related to querySelectorAll calls I suspect.)

I've discerned the cause: IE11 immediately fires an onChange event if the input placeholder contains a Unicode character. Guess what our placeholder for the search input includes?

… <- This.

Was this page helpful?
0 / 5 - 0 ratings