Do not autofocus text fields on page load on mobile devices. This is currently broken in many mobile browsers:

- iOS Safari opens the keyboard and auto-scrolls on the first tap anywhere on the screen triggering the click at an unexpected place. That makes it impossible to follow links or press buttons.
- Chrome on iOS opens the keyboard on load and may scroll the focused field off screen.
- The Android 4.4 browser only highlights the field, the user has to tap it to open the keyboard and type.
See #30703.

git-svn-id: https://develop.svn.wordpress.org/trunk@30842 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2014-12-13 22:07:58 +00:00
parent 074d8c1ad7
commit 2fc1155920
4 changed files with 10 additions and 1 deletions

View File

@@ -155,6 +155,8 @@ do_meta_boxes(null, 'normal', $comment);
</div>
</form>
<?php if ( ! wp_is_mobile() ) : ?>
<script type="text/javascript">
try{document.post.name.focus();}catch(e){}
</script>
<?php endif;