'How to prevent WebView from auto scroll up when soft keyboard is shown?
I am working on an Android Fragment that has a WebView component. Inside this WebView, there is a content-editable div used as compose area.
During development, I noticed whenever the content inside <div> is short, when it got focused and soft keyboard is shown, the WebView will be scrolled up automatically.
If the content inside <div> is long, such scroll up won't happen at onFocus stage. Unless the saved cursor is covered by soft keyboard area. (That means for short content, even if cursor can be displayed after focus, the WebView will still scroll up somehow)
To me, it seems that WebView (auto) Scroll logic is:
- If focused element height is less than the display area, scroll to the bottom line so the whole element can be fully displayed
- If the focused element is too long/large to be displayed as a whole, do nothing.
- If there is a cursor needs to be displayed, even 2, still scroll up until cursor is shown.
I googled a while but cannot confirm this logic system from official channel. However, I do see some discussion shared the same idea with me.
However, what I would like to know is, how to disable this kind of auto scroll up when content in a div is short...Any hints friends?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
