kogmbh/WebODF — pull request #410 by adityab (2014-02-21 12:21:40+00:00)
Title: iOS keyboard support

This PR:

1. Avoids setting focus after a click-to-move inside a timeout, if `window.navigator.platform` hints iOS. This is due to a [crazy quirk][1] wherein `focus()` calls only work if:
- They are inside the event handler of a user event like `mousedown`/`mouseup` (and also apparently called within 100ms of the event's firing).
- Not done within a timeout/interval.
2. Switches the eventTrap from a `contenteditable` `

` to a simple `` element. This gets rid of the native safari tooltip over the `eventTrap` with options to copy/paste/BIU, which don't work yet anyway.
3. Suppresses jittery automatic scrolling when tapping somewhere in the text to move the cursor when the keyboard is already open. This is done by momentarily setting `eventTrap.style.display = "none"`, waiting for the next animation frame - the opening of the keyboard - and then making it visible again. This means that the keyboard no longer knows where to scroll the body to, therefore it just meekly pops up without messing with the scroll.
4. Adds an attribute [`autocapitalize="off"`][2] to the `eventTrap` so that typing is in lowercase by default.

[1]: http://4pcbr.com/topic/how_to_open_keyboard_on_ipad_with_js
[2]: https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html

The scrolling fix also brings some benefit on Firefox on Android.