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

overlayContent=false is misleading in fullscreen mode -- potential solution: boundingRect should be available regardless of overlayContent value? #22

Open
josephrocca opened this issue Dec 28, 2023 · 0 comments

Comments

@josephrocca
Copy link

josephrocca commented Dec 28, 2023

In fullscreen mode on mobile (in Chrome and Firefox), the keyboard is always overlayed on the content. I'm guessing this is expected behavior, but this leads to a strange situation with respect to the Virtual Keyboard API:

Since boundingRect is (strangely?) only available when overlayContent==true, I'm unable to adapt my content to prevent the keyboard obstructing content (like the textarea being typed into) when in fullscreen.

So it seems that I'd need to do something like this:

document.addEventListener("fullscreenchange", function() {
  if(document.fullscreenElement) {
    navigator.virtualKeyboard.overlayContent = true; // switch to overlay mode to match "reality" when in fullscreen - this makes boundingRect available which is needed to adapt content
  } else {
    navigator.virtualKeyboard.overlayContent = false; // change it back when leaving fullscreen
  }
});

A simple fix for this would be to expose boundingRect when overlayContent is false too (whereas currently all properties of boundingRect are 0), since I'm guessing it's not possible to change the default "overlay" behavior of the virtual keyboard in fullscreen mode.

@josephrocca josephrocca changed the title virtualKeyboard.overlayContent=false is misleading in fullscreen mode - boundingRect should be available regardless of overlayContent value? virtualKeyboard.overlayContent=false is misleading in fullscreen mode [...] boundingRect should be available regardless of overlayContent value? Dec 28, 2023
@josephrocca josephrocca changed the title virtualKeyboard.overlayContent=false is misleading in fullscreen mode [...] boundingRect should be available regardless of overlayContent value? virtualKeyboard.overlayContent=false is misleading in fullscreen mode -- potential solution: boundingRect should be available regardless of overlayContent value? Dec 28, 2023
@josephrocca josephrocca changed the title virtualKeyboard.overlayContent=false is misleading in fullscreen mode -- potential solution: boundingRect should be available regardless of overlayContent value? overlayContent=false is misleading in fullscreen mode -- potential solution: boundingRect should be available regardless of overlayContent value? Dec 28, 2023
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

1 participant