javascript - Viewport shifted horizontally when textfield is focused -


this issue i'm having when textfield focused in sencha touch app

enter image description here

the textfield seems centered vertically , horizontally reason.

this how it's supposed look

enter image description here

does have same issue , solved ?

update

it not happen time happen on textfield not horizontally centered.

does happen on android (chrome 26)

i believe seeing (at least screenshots) ios's safari auto-zoom feature on input boxes. "phenomenon" automatically centers/focuses input box when gains input focus.

this <meta /> tag helps prevent that:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 

what <meta /> tag above accomplishes is:

  • rendering page @ device's screen width;
  • setting zoom level @ 1:1;
  • and fixing maximum scale 1 (essentially unscalable).

if page definite optimized mobile devices, above solution should work fine.


alternatively, in case you'd have control on <input /> control happens to, use:

<meta name="viewport" content="width=device-width" /> 

and then, set each <input />'s font-size style at least 16 pixels.

<input type="text" style="font-size: 16px;" /> 

this more compact <meta /> tag says page should presented @ 1:1 scale.


here's test page (shortened: http://bit.ly/15gbxja) demonstrate (hopefully) want fix. test page using second (alternate) method more fine-grained control; can take @ source code reference.

initial page display:

initial page display

with , without auto-zoom respectively:

auto-zoom enabled auto-zoom disabled


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -