The complete height of the website is concealed by the mobile toolbar/menu

I encountered a perplexing issue regarding the responsive resizing of a website on mobile devices. The problem arises when the full height extends over the toolbar/menu, unless the user manually hides the toolbar.

Is there a way to dynamically resize the site so that it fits within the inner window height of a mobile device and automatically adjusts when the toolbar is hidden? Below, you will find my test code along with examples illustrating the issue:

import React from "react"
import { styled } from '@material-ui/core/styles'

const App = () => {
  return (
    <>
      <List>
        <Block />
      </List>
    </>
  );
}

const Block = styled('div')({
  height: 100,
  width: '100%',
  background: 'white',
  marginTop: 'auto',
})

const List = styled('div')({
  display: 'flex',
  height: '100vh',
})

export default App;

https://i.stack.imgur.com/PqlHy.png

Answer №1

Mobile Safari presents some unique challenges when it comes to using 100vh. Currently, it calculates the viewport height based on the collapsed address bar and bottom browser buttons. Even when these elements reappear, the viewport size remains fixed at the "scrolled" position.

To address this issue, a new set of height declarations has been introduced. While the specification is being updated to handle this more effectively in the future, for now, the following code should help resolve the problem:

const List = styled('div')({
    display: 'flex',
    min-height: 100vh;
    min-height: -webkit-fill-available;
})

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to activate a click event on a dynamically generated input element with the type of 'file'?

I am facing a challenge in dynamically adding an input field of type 'file' to a form. The requirement is to allow the end user to add multiple files to the form, necessitating the use of an array concept. While I am able to inject dynamic elemen ...

Checking for a particular element's existence in an array using jQuery

Is there a way to verify the presence of the var element in the array sites? var sites = array['test','about','try']; var element = 'other'; ...

unique HTML elements located inside a text box

I am working on a system that allows users to customize order confirmation emails by replacing placeholders with actual customer data. Currently, we use tags like {customer_name}, but this method can be confusing and prone to errors. My goal is to create ...

Looking for a seamless way to convert jsp code to html using sightly in AEM 6.1?

I need help transforming JSP code to HTML using Sightly in AEM. In the JSP code, we have a scriptlet that stores a value from the dialog into a JSP variable called "coltype" using the code pageContext.setAttribute("coltype", xssAPI.filterHTML(properties. ...

When using ngClick with a parameter, the parameter is not being successfully passed

My table resembles a tree structure with two ng-repeats. <table> <tr ng-repeat-start="am in anArray"> <td><button ng-click="TheFunction(am)"></button></td> </tr> <tr ng-repeat-start="em in anotherArray"> < ...

Center text vertically even when its number of lines is unknown

Can anyone help me figure out how to vertically center text that can be one or two lines long? The text also has a specific line-height set. I attempted the solution provided in this link but it didn't produce the desired result: <div> < ...

Monitoring Javascript inactivity timeouts

As I work to incorporate an inactivity timeout monitor on my page, the goal is to track whether individuals working from home are present at their desks or not. The Jquery plugin http://plugins.jquery.com/project/timeout that I am utilizing initiates a ti ...

Unable to retrieve the text enclosed between the:: before and after the:: marker

I attempted this using the XPATH finder in Chrome, and it highlighted the element. However, when running my Selenium script, I received the following error: Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: ...

Mastering the Art of Utilizing $(this) in jQuery

$(".item_listing").hover(function(){ $(".overlay_items").display(); },function(){ $(".overlay_items").hide(); } ); This is my jQuery code. I am trying to display the "overlay_items" div when the "item_listing" div is hovered ov ...

Is there a way to dynamically adjust the height of a Materialize Slider based on its content?

Currently, I am working on a project utilizing the Materialize framework, specifically implementing its slider feature. However, I have encountered an issue regarding adjusting the height of the slider dynamically based on the content it contains. Is there ...

Setting up custom fonts in MUI v5: A step-by-step guide

I have the following: const theme = initiateTheme({ typography: { allTypes: CustomFont, fontFamily: 'CustomFontStyle' } as TypographyStyles, components: { MuiFormControl: { styleUpdates: { root: { fontFam ...

When clicking on Submit, the code does not acknowledge the Verify Function

I am currently facing an issue with implementing the JQuery Ui function "Verify();" to ensure that the name, age, country, and date fields are completed before allowing form submission. Even though I have written the verify function to execute when the us ...

My node.js code is not producing the expected result. Can anyone point out where I may be going wrong?

I've been working on a BMI calculator where I input two numbers, they get calculated on my server, and then the answer is displayed. However, I'm having trouble receiving the output. When I click submit, instead of getting the answer, I see a lis ...

React Higher Order Component (HOC) encountered an ESLint issue: spreading props is not

Does eslint lack intelligence? The Higher Order Component (HOC) is quite generic, so I struggle to specify the incoming options/props as they are dynamic based on the component being wrapped by this HOC at any given time. I am encountering an error statin ...

Tips on avoiding a page reload following a form submission using JQuery

Currently developing a website for my app development project, I've encountered an unusual issue. Utilizing some JQuery to transfer form data to a php page called 'process.php' and then add it to my database. The strange part is that the pa ...

The npm installation failed to execute when using Node.js version 16.0.0

Hey, I just cloned my repository and attempted to run npm install but encountered an error npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Found: <a href="/cdn-cgi/l/email-protection" class= ...

The error notification is not appearing in the correct location

I've been troubleshooting my jQuery error function for hours now (including the success function). I'm struggling to figure out how to display an error message only below the button that I click. To help clarify my issue, I've created a JSFi ...

Cannot locate a compatible version for @babel/traverse@^7.14.0

After attempting to clone a project and running npm install, I encountered the following error: npm ERR! code ETARGET npm ERR! notarget No matching version found for @babel/traverse@^7.14.0. npm ERR! notarget In most cases you or one of your dependencies a ...

Client-side image upload problem in Next.js API routes

I've been banging my head against this bug for a couple of hours now and I just can't seem to figure out the reason behind it. The issue is with an API route I'm trying to set up in next.js where I need to modify an image and then upload it ...

Is there a way in Ruby to extract the inner HTML of the <title> tag by loading the HTML source code of a webpage into a string and then parsing it?

Currently, I am trying to extract the inner HTML of the <body> tag from an HTML source string using Ruby. Does anyone know how this can be achieved? Despite my attempts to find a solution, I have been unsuccessful so far. Any guidance would be grea ...