fix(components): fix iOS select click event listening#16393
fix(components): fix iOS select click event listening#16393btea merged 1 commit intoelement-plus:devfrom
Conversation
iOS Safari does not handle click events when a mouseenter event is registered and a DOM-change happens in a child. We use a Vue custom event binding to only register the event on non-iOS devices. The inputHovering state gets updated now on iOS-devices on click. This is needed as the mouseenter event normally does this. closed element-plus#5210
|
👋 @raphaelbernhart, seems like this is your first time contribution to element-plus.
|
|
Hello @raphaelbernhart, thank you for contributing to element-plus, please see our guideline to see how to make contribution |
|
🧪 Playground Preview: https://element-plus.run/?pr=16393 |
|
@kooriookami @tolking Do you have relevant device verification? |
No, I have no IOS device. |
|
@btea Is there any updates here? :) We fixed it now with a custom installation of element-plus but we would really like to just use the npm package. |
I will participate in the verification tomorrow when I have time. |
There was a problem hiding this comment.
https://warmthsea.github.io/ios-select.mp4
test repo
test preview link
This PR does solve the problem that select(clearable) on iOS needs to be clicked twice before it can be opened.
(I only tested Safari on iOS Phone.)
You can consider publishing your own element-plus npm package for the time being. |
Yes, tho atm it is ok for us to keep the package locally, it would just be nice to have the upstream package for updating purposes. :) Thanks for the review! |
|
Thanks @warmthsea for the verification. @raphaelbernhart , sorry for the long time no response, I will try to verify it over the weekend. |
|
@raphaelbernhart It seems to be related to the system version. I used Safari to simulate an iPhone 15 and there seemed no problem. 🤔 |
Thanks for testing, tho I think this has something to do with your test environment. How did you simulate the iPhone 15? We tested it both on real devices (iPhone XR - iOS 16, iPhone 15 iOS 17) and a lot of simulated devices and it never works. Also as mentioned above I think this is not a "bug" on iOS devices but rather intended behaviour. |
Following the steps you described, it actually happened. |

Problem / fix
iOS Safari does not handle click events when a mouseenter event is registered and a DOM-change happens in a child.
We use a Vue custom event binding to only register the event on non-iOS devices.
The inputHovering state gets updated now on iOS-devices on click. This is needed as the mouseenter event normally does this.
Apple Developer Documentation: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
Vue Issue: vuejs/vue#9859
Here are some test-case recordings
Before changes
Screen.Recording.2024-04-04.at.11.07.08.mov
After changes
Screen.Recording.2024-04-04.at.11.09.15.mov
closed #5210