Why does the modal window gracefully descend when the mobile keyboard is activated?

I designed a modal window that has a fixed position:

<div className={classes['UIModal'] + ' ' + classes[transition]}
    onClick={() => dispatch(modalHandler('offer'))}
>
    <div className={classes['UIModal__container'] + ' ' + classes[transition]}
        onClick={e => e.stopPropagation()}
    >
        content
    </div>
</div>

UIModal -> backdrop covering the entire viewport

UIModal_container -> box containing the modal content

.UIModal{
  background: rgba(0, 0, 0, 0.66);
  height: 100vh;
  width: 100vw;
  position: fixed;
  top:0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  &__container{
    background: #171717;
    padding: 10px 50px;
    border-radius: 20px;
    border: 3px solid white;
    box-shadow: 1px 1px 50px #833AB4;
 }
}

You can test it out by clicking the "Consultation" button and typing on a mobile phone: source

P.S. I make use of the npm package "disable-scroll" when any modals are open:

const {offer, consultation} = useAppSelector(state => state.modalReducer)
 useEffect(() => {
        offer || consultation ? disableScroll.on() : disableScroll.off()
    }, [offer, consultation])

Answer №1

There was an issue caused by the disable-scroll library

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

I was able to resolve the fixed position issue of a button on Safari for iPhone 3G

Here is the setup I have on jsfiddle: http://jsfiddle.net/zZDqH/ Currently, there is a button fixed at bottom:0px. You can scroll up and down the page, and the button will stay at the bottom of the page. However, when testing in Safari on an iPhone 3G ( ...

Internet Explorer 8 is causing alignment problems with sidebars on certain websites within a Wordpress multisite setup

I am managing a Wordpress multisite setup with the following websites: The main portal: which connects to The issue arises on all pages of gprgebouw.nl and gpradvies.nl but not on the other domains. Attached is a screenshot of the homepage of gprgebouw. ...

What is the function of the "proxy" field in the package.json of a create-react-app project?

My NodeJS backend is running at http://localhost:4050, and my react application was originally configured to make API calls there. However, when I deployed the app on Heroku, I had to change the PORT variable in the backend to `process.env.PORT`. This ca ...

An unexpected error has occurred within React Native, indicating that an object is

It's baffling why I keep receiving the error message: "undefined is not an object (evaluating '_this.props.navigation.navigate')" I am fairly new to react and have tried every possible solution but still cannot resolve this error. Belo ...

Implementing the useEffect hook in React to iterate over JSON data and update the state

Having trouble implementing job location filtering ("remote"/"in-person"/"hybrid") for my personal project. As a beginner in programming, I've spent quite some time troubleshooting the fetchLocationData function and passing URLSearchParams. I anticipa ...

Displaying values dynamically as they transition between states in Reactjs

There are four components that I'm working with - UserHome, SearchFlight, Events, and Alerts. The UserHome component is where I import all the other components: <SearchFlight/> <Events /> <Alerts /> Within the SearchFlight compone ...

How can I limit Material UI Google Maps Autocomplete to only show results within a specific city and state?

Currently, I'm encountering an issue with the Google Maps Places Autocomplete feature in Material UI. I am struggling to limit the results that are being returned. Ideally, I would like only City, State suggestions to be displayed for user selection a ...

Is it possible to apply varying CSS styles depending on the parent element's class?

Apologies for the poorly worded question, but I am struggling to find the right terms to convey my query. Let me attempt to explain... Is it feasible to apply different css styles based on the classes assigned to the containing element? For example: < ...

Tips for scrolling a div that has too much content within a webpage

Is there a method to manipulate the scrollbar within a div on a webpage? Specifically, I am attempting to automate scrolling up and down on an Instagram post like . However, since the scrollbar may be hidden using CSS properties, detecting it can be challe ...

Using VML for background images in Outlook using HAML: A step-by-step guide

I am currently working on formatting an email digest using HAML and tables. My goal is to set a background-image to a table-cell in the email, but I've come to realize that Outlook requires VML in order to display a background-image correctly. After ...

Change the Background of Your Body?

Here's the deal. I'm looking to create a cool effect where the background of the body slowly fades out and changes periodically in a loop using CSS and jQuery. Any suggestions on how I can make this happen? Appreciate your help! ...

Troubleshooting the Uncaught Syntax Error in a React project running on Nodejs

I have been working on a React project locally and everything was running smoothly until I tried to integrate it with my node backend. Unfortunately, I encountered some errors during the build process. https://i.stack.imgur.com/Mi7Xv.png Here is the code ...

Tips for personalizing Bootstrap columns using identical class names?

Is there a way to customize the background color of each individual .col-5 within the same row while using Bootstrap and a custom CSS file? Changing the styles for one column seems to affect all columns with the same class name. Edit: I'm looking f ...

Bring in styles from the API within Angular

My goal is to retrieve styles from an API and dynamically render components based on those styles. import { Component } from '@angular/core'; import { StyleService } from "./style.service"; import { Style } from "./models/style"; @Component({ ...

Resizable dimensions for the dark mode switch

My latest project involves creating a toggle button for switching between light and dark themes using CSS, HTML, and JavaScript: id("theme-btn").addEventListener("change", function() { if (this.checked) { qs(".box").setAttribute('style', ...

Steps for importing a JavaScript file from Landkit into a Vue project

Currently, I am working on an interesting project and utilizing Vue with Landkit Bootstrap. However, I am encountering issues with the JavaScript behavior of the Landkit component. I usually import the following links in my index.html file, but in the new ...

Using React to Delegate a Function Passed in as a Prop to Another Function

The function signOut is passed from the parent component App to the stateless Header component as shown below: export default class App extends React.Component { constructor(props) { super(props); this.signOut = this.signOut.bind(this); } s ...

material ui modal component throws an error when referencing undefined variables

Is there a way to avoid the issue of canvasRef.current being undefined in this scenario? The canvas ref seems to be causing conflicts with the modal component from material ui. What steps can be taken to prevent this problem? Even after attempting to use ...

Script for deploying a React application to an S3 bucket

I'm currently working with a React app hosted on AWS S3 and I need to run the build & deploy script. Here's what I have in my script: "scripts": { "predeploy": "npm run build-css && NODE_PATH=src react-scripts build", "deploy": "aws ...

What is the best way to retrieve the href and id values dynamically from a card in React JS?

Hello everyone, I'm new to stackoverflow and still in the process of learning how to code. Please bear with me if this question sounds like a newbie one. My question is about having dynamic values for href and id when mapping data using axios to crea ...