Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't position 'relative' element just above keyboard #47

Open
thehappycoder opened this issue Oct 23, 2017 · 3 comments
Open

Can't position 'relative' element just above keyboard #47

thehappycoder opened this issue Oct 23, 2017 · 3 comments

Comments

@thehappycoder
Copy link

In Chrome 61 running on Samsung S7:

window.outerHeight is 310
viewport.height is 310

So I can't set bottom = of my relatively positioned element.

@bokand
Copy link
Collaborator

bokand commented Oct 23, 2017

The keyboard in Chrome today fully resizes the entire window, not just the visual viewport. So if you want to keep something above the keyboard, position: fixed, bottom: 0 will work.

There's an experimental flag (chrome://flags/#enable-osk-overscroll) that will cause the keyboard to resize only the visual viewport. In that case, window.inner/outerHeight won't change and you can use the difference with visualViewport.height to shift the element up. However, that's still experimental and it's not clear whether or not it will ship in this state.

@thehappycoder
Copy link
Author

Thank you @bokand
Unfortunately, I can't make it fixed.

@Malvoz
Copy link

Malvoz commented Oct 3, 2019

If the browser UI properties could be exposed as CSS environment variables, we could use CSS to account for e.g. the keyboard height, see: w3c/csswg-drafts#2630 (comment) and the following comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants