简体   繁体   中英

iOS input in fixed container focus bug

I am having a strange bug in ios safari where a position:fixed sidebar with an input in it which allows a user to perform a search query. Everything is fine when to scrollTop of the page is 0 (no scrolling occurred, top of page). At this state the input is focusable and the user can enter stuff in the input. However when the user scrolls a few pixels down the input is no longer focusable and the user can not input anything, nor does the keyboard show.

Anyone else ever encountered this bug or know a fix/hack that could solve this?

Thanks,

K.

This is not bug, when you tap the textFiled it becomes FirstResponder and you can enter text in it using keyboard. When you scroll the scrollView, textField will resign as FirstResponder and scrollview will become FirstResponder. So now you want be able edit text in textfield unless you tap it again.

Regarding keyboard not showing up, this is because when textfield resigns as FirstResponder it will call textFieldShouldEndEditing: delegate method and you might be returning YES in this method.

I changed all fixed containers to absolute positioned containers and now it works. Guess position:fixed still has some side effects in ios safari.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM