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

[dropdown] cannot use mouse on iPad #1989

Closed
jamessampford opened this issue Jun 17, 2021 · 2 comments · Fixed by #2331
Closed

[dropdown] cannot use mouse on iPad #1989

jamessampford opened this issue Jun 17, 2021 · 2 comments · Fixed by #2331
Labels
device/mobile Any issues relating to mobile devices type/bug Any issue which is a bug or PR which fixes a bug
Milestone

Comments

@jamessampford
Copy link
Contributor

Bug Report

Similar to #1988 a number of dropdowns will not work upon clicking with a mouse on iPad (namely a trackpad in my case). This again is using iPadOS 14.6. As per the slider, touch events work as expected

Steps to reproduce

  1. Click on each dropdown found on https://fomantic-ui.com/modules/dropdown.html most of the time there will be no response, ie. nothing happens on click

Expected result

All dropdowns should open

Actual result

A number of dropdowns do not open

Version

2.8.7

@jamessampford jamessampford added state/awaiting-investigation Anything which needs more investigation state/awaiting-triage Any issues or pull requests which haven't yet been triaged type/bug Any issue which is a bug or PR which fixes a bug labels Jun 17, 2021
@lubber-de lubber-de removed the state/awaiting-triage Any issues or pull requests which haven't yet been triaged label Jun 17, 2021
@lubber-de
Copy link
Member

My same guess as for slider: The module checks for a touchdevice (which the ipad still is) and either binds touch or mouse events. As the mouse events are not bound, the mouse is not triggering the necessary events.

@mhthies
Copy link
Contributor

mhthies commented Apr 16, 2022

Just as for #1988, the issue is caused by the distinction between touch and non-touch devices (see dropdown.js, line 702): On touch devices, only (!) touch events are handled, on non-touch devices (only) mouse events are handled.

Again, IMHO, the trivial solution would be removing this whole distinction and all the touch event binding code.

However, I learned from the Git history, that the distinction is required to mitigate some missing click events on iOS (#647, #1220), which seem to originate from strange behaviour in the mouse emulation of iOS Safari (see this StackOverflow thread: https://stackoverflow.com/questions/24077725/mobile-safari-sometimes-does-not-trigger-the-click-event). If the iOS issue in #647 could be fixed with one of the other workarounds, mentioned there, it would be possible to remove the special handling of touch events, as suggested above.

Otherwise, I would suggest always binding to both, mouse and touch events, and adding event.preventDefault() to the event handlers to avoid double-triggering through the browsers' mouse emulation.

@lubber-de lubber-de added the tag/help-wanted Issues which need help to fix or implement label Apr 16, 2022
mhthies added a commit to mhthies/Fomantic-UI that referenced this issue Apr 19, 2022
Instead of distinguishing between touch and non-touch devices and
binding to different events, we always bind to mouse events. For touch
input, we mostly rely on the mouse event emulation (esp. click and mouseenter
events) of modern browsers.

This fixes fomantic#1989
@lubber-de lubber-de added state/has-pr An issue which has a related PR open and removed tag/help-wanted Issues which need help to fix or implement state/awaiting-investigation Anything which needs more investigation labels Apr 19, 2022
@lubber-de lubber-de modified the milestones: 2.9.x, 2.9.0 Apr 19, 2022
lubber-de pushed a commit that referenced this issue May 1, 2022
This PR fixes #1989 in a similar way as my previous PR for the slider (#2327): First, I removed all special event handling for touch events and the whole distiction between touch- and non-touch devices, so mouse events will be handled on touch devices as well. Then, I added only a few touch event bindings for the things that don't work via mouse event emulation of the mobile web browsers.

In addition, I fixed two minor bugs with nested submenus being not correctly hidden in some cases (see commit messages for more details).

I tested everything on

Chrome mobile on Android (with touch and Bluetooth mouse)
Firefox mobile on Android (with touch and Bluetooth mouse)
Chromium on Linux/X11 (with multitouch screen and mouse)
Firefox on Linux/X11 (with multitouch screen and mouse)
@lubber-de lubber-de added tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build and removed state/has-pr An issue which has a related PR open labels May 1, 2022
@lubber-de lubber-de removed the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device/mobile Any issues relating to mobile devices type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants