javascript - iOS Safari input type text partially loses focus after element resize -



javascript - iOS Safari input type text partially loses focus after element resize -

i have input element type='text' gets buggy state in ios safari, such input element appears focused , dispatches keyup events not update value of field; no new characters visible user types. in website building trigger state after resizing** focused text input element***. have made jsfiddle reliably reproduces bug:

<input id='ipt' type='text' style='width:250px;height40px;'/> <script> var ipt = document.getelementbyid('ipt'); ipt.addeventlistener("keyup", onkeyup, false); function onkeyup(e){ ipt.style.width = '100px'; ipt.removeeventlistener("keyup", onkeyup, false); } </script>

to reproduce bug:

open http://jsfiddle.net/55dth/embedded/result in ios safari focus input element tap pinch zoom show total width of input (necessary trigger bug) type something

i understand why getting buggy state, , how might able avoid it. may involve beingness in iframe , document settings. have in iframe, , need alter width of text field.

or how out of state. can observe in state, listening keyup , checking value @ insertion point compared key value in event. tried toggling readonly, resetting value, focus(), toggling inputmode...

** want resize element - there more horizontal space type when keyboard up.

* pretty sure other conditions necessary state, not sure of exact conditions.

javascript html input mobile-safari

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -