marco-pm / zencart_instantsearch

Instant Search plugin for Zen Cart
GNU General Public License v3.0
2 stars 4 forks source link

Dropdown links don't work on Safari #23

Closed marco-pm closed 1 year ago

marco-pm commented 1 year ago

As per this forum post:

Experiencing an issue only on Safari browsers (iOS and Mac) where the dropdown seems to close too early on clicking a product link. You click on a result in the dropdown menu but you aren't routed to the link you clicked on, you remain on the same page.

marco-pm commented 1 year ago

The cause of the problem is explained here and here. In short, when a link is clicked, blur is fired right before click, and on Safari event.relatedTarget.classList is empty, causing setShowResults(false) inside the handleBlur() function to execute and then the dropdown to close.