Changes in bottom position when scrolling in landscape mode on iOS Safari

I'm currently using ReactJS and have implemented a mobile menu bar with CSS properties position: fixed and bottom: 0. The menu bar stays locked at the bottom of the page in both portrait and landscape orientations on all browsers except for Safari.

In portrait mode, everything works as expected. However, when switching to landscape, the menu bar is positioned correctly until the page is scrolled down. When Safari removes the search menu, it causes the menu bar to be pushed below the visible screen area. It appears that the removal of the search menu is shifting the bottom of the document off-screen. Despite extensive research, I haven't come across any solutions for this issue, indicating that this behavior may be specific to Safari. Does anyone have any suggestions or fixes?

For reference, here is the relevant component: https://github.com/Taouen/gobble/blob/master/src/components/MobileBox.js

Answer №1

It seems that the issue may stem from utilizing vh in your code.

Interestingly, Safari on IOS employs a vh value equivalent to 1% of screen height, regardless of whether the search bar is visible at the top or not. This feature aims to prevent any abrupt jumps when users scroll down and the search bar vanishes.

For more information, you can check out: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/

An alternative solution mentioned involves using --vh, which is defined as one hundredth of window.innerHeight instead of vh.

(This comment should ideally be posted in response to the original query since it's not a comprehensive, tested solution. However, I lack the necessary reputation to do so. Apologies for the inconvenience.)

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

When a page first loads in Next.js with Firebase, the useEffect hook may return an undefined value

My component is designed to retrieve a subcollection from firestore: import { useEffect, useState } from "react"; import { db } from '../firebase/firebaseInit' import {useAuth} from '../components/AuthContextProvider' import { ...

Tips for properly utilizing "require" in application.css with the Skeleton framework

I am currently working on implementing the skeleton-rails CSS framework into my application. Within the app/views/layouts/application.html.erb file, I have created containers and a list nav that require styling. Following the guidelines provided by the ske ...

Can a feature be utilized to generate a personalized block within my gutenberg block?

I am currently working on a slider block and my goal is to generate a slide block for each image I select. After successfully creating the slide block, the challenge now lies in calling the slide block from the slider block. I believe there must be a way ...

React: Component rendering unsuccessful

Hey everyone, I’m a beginner in React and having trouble trying to render my component into the app component. Here is the code: conditionalView.js: import React, { Component } from 'react' export class conditionalView extends Component { ...

The appearance of all input forms in MaterializeCSS when used in an electron environment appears to

After following the instructions here on how to get started with Materialize CSS, I am having issues with my input form appearing strange: https://i.sstatic.net/lveS2.png The contents of my current index.html file are as follows: <!DOCTYPE html> &l ...

Utilizing environment files for securing and managing private keys in React applications

Hello everyone, I have a query for the tech community. I am currently working on integrating some payment functionalities that require me to use a private key to access certain endpoints. In the past, I have stored keys in the environment for smaller proj ...

Are you experiencing empty boxes instead of Glyphicons in Bootstrap 3?

Having some trouble using Glyphicons with Bootstrap 3. I've noticed that a few of them aren't displaying properly. For instance, when trying to use these three glyphicons, the first one doesn't seem to show up correctly (appears as an empty ...

The peculiar characteristics of the dragLeave event in various web browsers

I observed a peculiar behavior while working with drag events in Internet Explorer 11. It seems that adding a 'width' property to the elements triggers the dragLeave event, whereas without it, the event does not fire. Can anyone shed light on why ...

hover-triggered keyframe animation

Recently, I've been experimenting with CSS keyframe animation using the code below: .pulse-animation { margin: 50px; display: block; width: 52px; height: 52px; border-radius: 50%; background: #ff8717; cursor: pointer; animation: pul ...

Tips for Creating an Upward-Dropping Dropdown Menu in HTML/JavaScript When Space is Limited on the Page

Hello, I am currently seeking a solution to adjust my dropdown menu so that it appears above instead of below when the page doesn't have enough space to display it fully. My tools for this project include HTML, Javascript, CSS, and JQuery exclusively. ...

Fetching data in React using AJAX

I am in the process of developing a React Component that will display data retrieved from an AJAX call. Here's my scenario - I have a Jinja Flask back end hosted on AWS API Gateway, which requires custom headers and the Authorization header to serve H ...

How can you easily add animation to a `React.Component` using `react-spring` whenever a prop changes?

Looking to animate a React Component using the react-spring library based on prop updates? I stumbled upon this https://codesandbox.io/s/xpqq0ll5nw and I'm interested in recreating it with hooks. const Counter = ({quantity}) => { const animatio ...

Issue with fixed header in Vuetify v-data-table not functional

While working with the Vuetify v-data-table component, I have enabled the fixed-header property. However, I have noticed that the table header is scrolling along with the table body. I am using the latest version of Chrome. Does anyone know how to addres ...

Issue with Reactstrap: Row/Col classes not functioning properly with Card component

I am working on a React app and using Reactstrap for styling. I have a single Card within my Container that I want to run full width, but when I use the classes col-md-6 for different parts of the CardBody, it is stacking vertically instead of horizontally ...

The Autocomplete feature in Material UI is failing to function properly when paired with a

I have a requirement to customize the Autocomplete Highlight feature provided in a specific example to suit my project needs. (Link: Material UI Autocomplete Documentation) The original Highlight example includes borders which I removed by referring to th ...

Is there a way to navigate to the home page using a PNG icon without refreshing the page when clicked on, while also utilizing NavLink with a route of '/'?

Here's the code I'm working with: <div key="1" className="menu-item"> <NavLink to="/"> <span className="icon-home3" />&nbsp; Home </NavLink> </div> The Home button functions ...

Tips for serving images locally instead of using an online URL when exporting with Next.js static:

I've encountered an issue where multiple images pulled from an online source are not being included in my export when I start the process. The image URLs are stored as strings online, but I want them to be saved locally and exported that way instead o ...

Eliminate placeholder text when the tab key is pressed

I'm currently facing an issue with a textarea that has a placeholder and the Tab key functionality in Internet Explorer. I've included placeholder.js to make it work, but when I repeatedly press the tab key and focus on the textarea, the placehol ...

My React project is unable to import the foundation SCSS file into the App.scss file

After installing zurb-foundation using npm, I attempted to import the .scss file into my App.scss file. Utilizing the "live sass server" for compiling the .scss code into .css code, a .css file was generated but did not display any code despite successfull ...

What is the best way to activate a component's function within a disabled tab using material-ui?

Currently, I am utilizing tabs from M-ui and encountered an issue when trying to incorporate a switch as one of the tabs. I made the tab non-clickable, but now the switch inside it is also not functioning. Below is the code snippet: https://codesandbox.i ...