Feature request: Button to hide (toggle) the virtual keyboard inside the keyboard itself 🔽
When a math field is placed at the bottom of the screen or inside a dialog (such that it's not possible to scroll further down), opening the virtual keyboard (which opens onfocus by default on mobile) would hide the field itself, along with the virtual keyboard toggle.
In this case, there is no way for the user to hide the virtual keyboard unless they click outside the math field (blur). It would be nice if a simple chevron arrow to hide the virtual keyboard was added at the top-right corner of the keyboard.
An alternative idea (more complicated) is for the keyboard to check the position of the mathfield (y coordinate), and if the field is in the bottom 250px of the screen, then to automatically move the entire keyboard to the top-most part of the screen (to avoid covering the mathfield).
A couple of comments:
- When a mathfield is focused (such as when tabbing through mathfields), it will be scrolled into view. If the mathfield is already focused however, it is not scrolled into view when the keyboard appears. Perhaps that's the behavior that should change.
- When the keyboard is displayed, the height of the container is adjusted so that it is possible to scroll and reveal the mahtfield, even if it was at the very bottom of the page
- There is an (optional)
[hide-keyboard]keycap that can be added to keyboard layouts
Thank you for the clarifications, @arnog!
Indeed, when the keyboard is displayed, you add padding-bottom: 313px to the <body> so that it is always possible to scroll and reveal the mathfield.
In my case however, the mathfield is inside a dialog (with position: fixed), making the <body> padding ineffective.
In the meantime, I worked around the issue with some CSS inspired by your solution:
body:has(> .ML__keyboard) dialog-container {
padding-bottom: 300px;
}