timruffles / mobile-drag-drop

A drop-in shim to allow you to use existing html5 drag'n'drop code with mobile browsers

Home Page:http://timruffles.github.io/mobile-drag-drop/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not automatically apply in iOS/iPad 15 when desktop website is requested

jogibear9988 opened this issue · comments

The polyfill does not work on IOS 15 any more, cause the useragent changed, and does not contain "iPad" or "iPhone"

I would suggest following code:

navigator.maxTouchPoints && navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome'),

Thanks for reporting. I was afraid a breaking change like that would happen eventually 😞

For everyone affected: It is possible, to use the forceApply flag in the polyfill config to provide your own feature-detection until the polyfill is released with adjusted default feature detection.

The current code is

const isBlinkEngine = !!((<any>window).chrome) || /chrome/i.test( navigator.userAgent );
features.userAgentSupportingNativeDnD = !(
// if is mobile safari or android browser -> no native dnd
(/iPad|iPhone|iPod|Android/.test( navigator.userAgent ))
|| // OR
//if is blink(chrome/opera) with touch events enabled -> no native dnd
(isBlinkEngine && ("ontouchstart" in document.documentElement))
);

Relates to #152

So I got around to play a little with an iPad Pro which has iOS 15.2 installed.

Requesting the desktop site (Safari feature which users can toggle to their liking) causes the User Agent to contain Macintosh instead of iPad. The polyfill does not kick in, but with some minor fixing the demo site of this polyfill works fine (mainly fixing some glitches, no real problems). It is quite similar to the "holdToDrag" experience.

Requesting the mobile site the User Agent contains iPad, the polyfill kicks in and drag and drop works as configured.

So to me, not fixing the user agent does not break an application. It just may behave a little different if e.g. no or a different holdToDrag is configured.

My personal opinion is that the polyfill should not take away the native experience by default, meaning that it is fine as is, but the current state of drag and drop should be refreshed and available options may should be made more visible in the README.

I don't own an Android device and only rely on Chrome mobile emulation for testing. Does anyone know if that is accurate enough to conduct testing if Android native drag and drop does work? I could of course also spin up an Android Emulator.. but time and energy are scarce for me, meaning I have to keep it as simple and easy as possible.

EDIT: I also checked if the polyfill and native experience step on their toes but they seem to be working fine side by side.