Hi! Does anyone know how to prevent content from r...
# compose-web
p
Hi! Does anyone know how to prevent content from resizing when the keyboard opens? 🧵 ⬇️
photo_2025-07-14 00.00.54.jpeg,photo_2025-07-14 00.00.52.jpeg
Copy code
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spy Game</title>
    <link type="text/css" rel="stylesheet" href="styles.css">
    <script type="application/javascript" src="composeApp.js"></script>
</head>
<body>
</body>
</html>
Copy code
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: rgba(18, 31, 44, 1);
}

*:focus {
    outline: none;
}
Above: Android screenshots. Below: iOS — no keyboard-related content resize; the dialog stays in place 🤔
photo_2025-07-14 00.35.34.jpeg
b
seems to be an 11 year old issue in webkit, wow. have a look here: https://stackoverflow.com/questions/23023549/get-viewport-height-when-soft-keyboard-is-on
p
My goal is to make the keyboard raise the dialog, and the content size remains the same, so that the screen is not flattened. The behavior on the web on Android and iOS is different, but neither of them is preferable. But the same code on a mobile phone works as it should.
b
you could try raising the dialog by
window.visualViewport.height
like some have tried in the link 🙂
thank you color 1
p
But I absolutely do not want the content to be resized for the viewport like on Android and I can't find a way to do this. On Flutter this behavior is out of the box, 😞
b
I don't think there is a problem with that. the user just needs to see the element in focus, that they are writing text into and for the app to show him the next one/previous one when tabbing. just get the job done my guy and refine it some other day.