harvesthq / chosen

Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
http://harvesthq.github.io/chosen/
Other
21.85k stars 4.1k forks source link

Fails to load when Chrome is set to touch mode #3125

Closed qianshancun closed 2 years ago

qianshancun commented 2 years ago

Fails to load when Chrome is set to touch mode:

This issue happens on the official page: https://harvesthq.github.io/chosen/

Screenshot:

image

tjschuck commented 2 years ago

@qianshancun Are you talking about #top-chrome-touch-ui in chrome://flags/ ? If so, I cannot reproduce.

If you're talking about changing the "Device" in the web inspector, this behavior is expected if you're changing to a device with a mobile Android user-agent. See the third question in the FAQ. Chosen is disabled for any user-agent that includes both Android and Mobile.

qianshancun commented 2 years ago

@qianshancun Are you talking about #top-chrome-touch-ui in chrome://flags/ ? If so, I cannot reproduce.

If you're talking about changing the "Device" in the web inspector, this behavior is expected if you're changing to a device with a mobile Android user-agent. See the third question in the FAQ. Chosen is disabled for any user-agent that includes both Android and Mobile.

@tjschuck You can do this to reproduce it:

image

tjschuck commented 2 years ago

@qianshancun Okay, that's the second thing I mentioned. I can reproduce when I do what's shown in your screenshot, but using those settings, my request has the User Agent Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Mobile Safari/537.36 — that User Agent matches on the Android + Mobile check, so Chosen is intentionally disabled.

See https://github.com/harvesthq/chosen/pull/1388 for more info about why Chosen is disabled in touch environments.

qianshancun commented 2 years ago

Hi, thanks very much for the information. Is there any way I could keep it enabled? Like passing in an option like this:

$el.chosen({bypass_mobile_disable:true});
tjschuck commented 2 years ago

There's no existing option like that, no. Your best bet would just be to locally modify the browser_is_supported check to do what you'd like.