2021年4月9日星期五

jQuery UI autocomplete can't blur on mobile chrome

I have a piece of code which works fine on pretty much every browser I managed to get my hands on, except for mobile Chrome. My goal is to get it working on this specific browser because the same page is intended to work for both desktop and mobile. It uses jQuery UI's autocomplete widget, and blurs the input after an option is selected. The alert is a check to demonstrate that the blur function isn't working.

Snippet:

$('#test').autocomplete({      source: ['test1', 'test2'],      delay: 300,      minLength: 1,      change: (event, ui) => {          console.log(alert(JSON.stringify(ui)));      },      select: (event, ui) => {          event.preventDefault();            document.querySelector('#test').blur();      },  });  

Fiddle: https://jsfiddle.net/gyhszpxv/

Mobile Chrome version: 89.0.4389.105

Is it fixable with js only?

https://stackoverflow.com/questions/67029913/jquery-ui-autocomplete-cant-blur-on-mobile-chrome April 10, 2021 at 09:06AM

没有评论:

发表评论