readium / r2-testapp-swift

BSD 3-Clause "New" or "Revised" License
146 stars 38 forks source link

EPUB3 Javascript button click works but requires hard press for extended period of time, while Javascript submit button click works immediately #239

Closed sumahadevan closed 5 years ago

sumahadevan commented 5 years ago

In a simple EPUB3 with scripting (Javascript), the button click touch event works in R2 Reader on iOS, but the click requires a very sustained and hard press on the button. However, if the button is not a normal click button but an input of type "submit" (rendered by Javascript as a button), then the response to the touch/press is immediate. This can be seen with the attached EPUB3 which implements simple addition, where the different pages try variations of the Javascript code with both regular click and submit buttons. The buttons labeled Click are hard to press, while those labeled Submit can be pressed immediately. Note that by pressing the Return or Next Tab key on the Android touch keyboard it is also possible to confirm that the addition gets correctly executed.

The same EPUB3 (button-click-epub3.epub) works fine in the R2 Reader desktop app (with mouse input), but click and submit buttons do not work at all in the R2 Reader Android app (with touch input), issue below.

https://github.com/readium/kotlin-toolkit/issues/251

Version and Device Details: R2 Reader iOS App version: 1.0.5 GitHub Tag: V1.0.0-beta.5 iOS mobile device: iPod Touch 6th Generation running iOS 12.1.4.

Note: I had to rename the .epub as a .zip to upload it (you may unpack it or rename it as .epub and then look at the code of individual XHTML pages, which is just basic Javascript).

button-click-epub3.zip

sumahadevan commented 5 years ago

I have now installed the latest build on iOS, namely:

Version and Device Details: R2 Reader iOS App version: 2.0.0 Build version: 21 iOS mobile device: iPod Touch 6th Generation running iOS 12.3.1.

(GitHub tags for beta being replaced by build versions as required by Apple). During this period I have also been able to build the app on iOS (and on Android as well). I then tracked down where the actual Javascript code for touch handling currently is. It was previously in a submodule file called R2Streamer/scripts/touchHandling.js (which no longer exists), but the code has now been moved to a different submodule, in the file

https://github.com/readium/r2-navigator-swift/blob/develop/r2-navigator-swift/EPUB/Resources/gestures.js

Improvements for handling interactive tags have been made in this file, but 'button' has not been included in the list of interactive tags there, hence the issue with standard button clicks (as opposed to 'submit' buttons) persists. I will log the issue there, and reference this issue.