Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard appearing on mobile devices #42

Open
GoogleCodeExporter opened this issue Feb 15, 2016 · 3 comments
Open

Keyboard appearing on mobile devices #42

GoogleCodeExporter opened this issue Feb 15, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Discovered this whilst browsing the Go Tour on my iPad, when new pages of the 
tour are display (pressing previous/next) the software keyboard is displayed 
every time. I am unsure whether this is the intended behavior of the Go Tour, 
but regardless, it was very frustrating on a mobile device.

This is being caused by line 185 of /static/tour.js 
(https://code.google.com/p/go-tour/source/browse/static/tour.js#185):

181        } else {
182                $('#workspace').show();
183                $output.empty();
184                editor.setValue(load(i) || $s.find('pre.source').text());
185                editor.focus();
186        }

I propose that setting focus of the code area should only happen when the 
client is known to have a hardware keyboard. This may be a rather big ask, so 
instead, don't set focus on a mobile device.

Original issue reported on code.google.com by nadineng...@gmail.com on 16 Sep 2012 at 7:57

@GoogleCodeExporter
Copy link
Author

Any idea how to reliably detect when we're on a mobile device?

Original comment by a...@golang.org on 17 Sep 2012 at 4:56

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

A quick and simple way as discused here http://stackoverflow.com/a/3540295 is 
to check for keywords in the user agent.

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows 
Phone/i.test(navigator.userAgent) == false) {
        editor.focus();
}

N.B. I have included Windows Phone in there too, seperate from the SO answer.

Projects like http://detectmobilebrowsers.com/ offer more robust solutions for 
multiple platforms, they appear to have jQuery script, so that should fit right 
in with the Go Tour already.

Original comment by nadineng...@gmail.com on 18 Sep 2012 at 11:32

@GoogleCodeExporter
Copy link
Author

Removing the call to editor.focus() completely (for all platforms) is another 
option.

It's simple, keeps the experience consistent across browsers and isn't a huge 
loss.

Choosing to edit the code requires enough activity that an extra mouse click 
won't be a burden.

Original comment by josephmd...@gmail.com on 19 Mar 2013 at 6:46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant