I am working on designing Web Application which wants only 100% of screen means not to scroll, that's why am using 100vh . In which having some input fields, its working fine on the desktop but when i am clicking on input field on Mobiles and Tablets there keyboard is opening by which layout is getting effected Click how its working. Anyone can help me that how can i handle this situation using CSS or JS, So that the layout is also correct and can be typed on the keyboard as well.. Thanks in advance.
Here is a link click here to know what is happening.
The way I tried is that when the input field is active then the screen size which is being compressing will add 250px height for particular devices.
const documentHeight = () => {
const doc = document.documentElement;
const platforms = ["Android", "Linux", "arm"];
const isAndroid = new RegExp(platforms.join("|")).test(
window.navigator.userAgent
);
if (!isAndroid)
document.addEventListener("touchmove", function (event) {
event.preventDefault();
});
if (window.innerHeight < 667 && isAndroid) height = 250;
else height = 0;
doc.style.setProperty(
"--doc-height",
`${window.innerHeight + height}px`
);
};
window.addEventListener("resize", documentHeight);
let htmlTag = document.getElementsByTagName("html");
let root = document.getElementById("root");
{
if (width <= 768) {
documentHeight();
htmlTag[0].style.position = "fixed";
htmlTag[0].style.overflow = "hidden";
htmlTag[0].style.width = "100vw";
}
} else {
const doc = document.documentElement;
doc.style.removeProperty("--doc-height");
}
});