-
Notifications
You must be signed in to change notification settings - Fork 209
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
fix(picker): don't handle pointerdown for touch devices #4850
fix(picker): don't handle pointerdown for touch devices #4850
Conversation
Pull Request Test Coverage Report for Build 11727934956Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! We would appreciate if you can surface up an isolated test for this touch event!
Here's a couple of thoughts:
You could try logging in our this.preventNextToggle = 'no'; // could we be delaying this too much? Our current public override handleActivate(event?: Event): void {
...
if (event?.type === 'click' && event instanceof PointerEvent && event.pointerType === 'touch') {
// If the event is a touch event, let us try to always trigger the toggle
this.host.toggle();
return;
}
if (event?.type === 'click' && this.open !== this.pointerdownState) {
return;
}
this.host.toggle();
} And lastly, because I lack the understanding of how events work on the iPad, you could check whether |
Yes, this is reproduced in the Storybook and in the studio example for Action Menu and Picker as mentioned before in the Slack conversation. I used an iPad 12.9" iOS 17.4.1. It only reproduces on physical devices (I was unable to reproduce on Simulator). I will be forwarding future investigation to the SWC-Express team, if that is okay. cc @Rocss |
I've been investigating this issue and it seems like the problem resides in popover's toggle events being fired like this on iPad:
When the bug reproduces (I was able to reproduce it in the Simulator, on iPad v17.4, as well as the real device), only the first 2 events trigger, making the popover stay closed. I haven't been able to find a fix other than the one provided here by Helen, but something else I've observed is that if we do not early return in the For now this seems like the only approach that fixes the existing problem without affecting current behavior caught in unit tests. Could we go forward with this, @rubencarvalho ? @Rajdeepc , how would you write a test for this scenario considering that it's doesn't always reproduce and it's specific on iPad? |
Thanks for the added context. What do you think, @Rajdeepc? |
Co-authored-by: Helen Le <[email protected]> Co-authored-by: Rúben Carvalho <[email protected]>
Description
Don't handle pointerdown for touch devices from the picker's desktop controller, which applies to devices such as iPads. This fixes an issue where pointerdown would retrigger the picker to close early, causing inconsistent behavior.
For more context, see conversation here: https://cclight.slack.com/archives/CESK60MQD/p1729107196370669
Related issue(s)
Motivation and context
Fixes
sp-picker
bug on iPad devices.How has this been tested?
Tested on Express mobile app on iPad and in Storybook on local dev environment.
Test case 1
Did it pass in Desktop?
Did it pass in Mobile?
Did it pass in iPad?
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.