SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 295 forks source link

iOS requires two clicks to show keyboard with dgrid editor and custom widget #1345

Open adamdport opened 7 years ago

adamdport commented 7 years ago

In my implementation, my cells require two clicks to show the keyboard on iOS. The first click creates the input, but a second click is required to focus the input.

After investigating, the issue is in this setTimeout method. iOS will only show the keyboard if the focus is executed via something that was initiated via a user action. I've verified that removing the setTimeout from dgrid resolves my issue.

The comments surrounding the setTimeout imply that it's necessary for dgrid-cellfocusin. I'm using editon: 'click'. I'd be happy to try to recreate it in a jsfiddle if you can provide a starting point (basic grid with a custom widget). Thanks!

dylans commented 7 years ago

@adamdport here's a relatively recent jsfiddle you can clone, https://jsfiddle.net/dylan/9rgodm0e/3/ . It doesn't have a custom widget, but feel free to ask if you get stuck.

adamdport commented 7 years ago

Turns out it's not related to our custom widget. Nothing in this fiddle launches the keyboard on first click in iOS: https://jsfiddle.net/55g58b4L/6/

Let me know if I'm doing something wrong. Thanks.

adamdport commented 7 years ago

Any updates on this? Could you at least confirm it's a dgrid issue and not just something I'm doing wrong?

dylans commented 7 years ago

I started looking at it a few days ago, and I get very intermittent results... sometimes a first tap works, sometimes it takes several taps to get anything to respond. However, when I try out our tests such as http://dgrid.io/js/dgrid/test/Editor.html I don't see a similar issue, so then I started wondering if it was either something odd with JSFiddle, or something on iOS with a combination of the Keyboard and Editor mixins. My guess is that something has changed in a subtle way with iOS 10, focus events, and pointer event handling, but that's as far as I've gotten thus far.

adamdport commented 7 years ago

I'm going to test it again tomorrow, but I believe removing the timeout I linked to resolved my issues, and the comment above it suggested it was only to resolve some dgrid-cellfocusin issue:

// focus / blur-handler-resume logic is surrounded in a setTimeout // to play nice with Keyboard's dgrid-cellfocusin as an editOn event

I don't know what that original issue was, but perhaps there's a way to resolve it without this timeout.

adamdport commented 7 years ago

I've tested again, and confirm that commenting out the timeout (so that the focus() commands happen immediately) resolves the issue for me.