jetzt
jetzt copied to clipboard
Current key handling disturbes mobile usage
I want to improve Jetzt for use on mobile devices. One of the first frustrating things is that is somehow seemed to zoom in and open the keyboard (Using Chrome on Android). Looking through the code this is caused by manually setting focus on the hiddenInput field. (hiddenInput.focus();)
Why do we do this? My guess is that we do this to override all default actions behind keys, like pressing down scrolls the page down.
But I found that using return false in the keyDown handler prevents this as well.
Does someone care to comment?
The hidden input thing was done to address this issue: #18
I just did some googling and found out you can capture keydowns with a div if you set tabindex=0. That probably won't bring up the keyboard.
I understand. Maybe I'll set up a test site which uses keys (because the mentioned website is down) and experiment further. Setting the tabindex to 0 doesn't seem to prevent the keyboard popup (see below how I tried). Maybe I'll try setting focus to the reader itself instead of a input element, because it makes sense for mobile operating systems open the keyboard and zoom in on them.
hiddenInput.setAttribute("tabIndex",0);
hiddenInput.tabIndex = 0;
try changing hidenInput to a div first ;)
In a quick test that seemed to highlight the left wrapper... Not sure why. But when we can set the focus to the reader itself there is no need for a hidden element, which seems better, less hacky.
Setting the focus to a div hiddenInput or the reader as a whole solves the problem in Chrome on Android. It also still steals the focus of a website like t3n.de.
Should I do a PR on dev, even though you guys are rewriting it into coffeescript or should I do a PR on coffee?
Just merge it straight into dev. :+1: I'm going to do the js2coffee thing today.