Encountering a problem with Material UI where the drop-down options are appearing below the footer of the modal window

Hey there, I'm currently using Material UI and React Select. One issue I've run into is that my dropdown options are appearing below the modal window.

You can check out the code sandbox demo here

https://i.sstatic.net/Av6Pe.jpg

I've tried adjusting the z-index and changing the position value to absolute, but haven't had any success yet. Any help would be greatly appreciated!

Answer №1

The reason for this issue is due to the overflow-y rule being applied in two different areas: the dialog paper and the dialog content. To resolve this, you can utilize material-ui styling to override these rules:

import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles({
  paperFullWidth: {
    overflowY: 'visible'
  },
  dialogContentRoot: {
    overflowY: 'visible'
  }
});

Then, you can assign these classes to your component:

const classes = useStyles();
   ...
<Dialog
        ...
        fullWidth={true}
        classes={{
          paperFullWidth: classes.paperFullWidth
        }}
      >
  ...
 <DialogContent
        classes={{
          root: classes.dialogContentRoot
        }}

You can view a demo of this solution on CodeSandbox

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

Center the form on the page using Bootstrap

My bootstrap login form is currently appearing at the top of the page, but I want it to be centered. <div class="container"> <div class="row text-center"> <div class="col-sm-6 col-sm-offset-3 well offset4"> <div class=""&g ...

Setting up Webpack to match the necessary folder structure for building files

My ReactJS application is built using Webpack. In my webpack.config.js, I have set up the necessary code to generate a build, resulting in all files being placed in a 'build' folder within my project directory. The current file structure looks l ...

What is the best way to stack several items vertically beside an image?

As a beginner in the world of web development, I recently embarked on my first project. However, I am facing an issue where I cannot align multiple elements under each other next to an image. One element floats at the top beside the image, while the other ...

Is there a way to simultaneously run both my Node application and React app with just one command?

I am planning to create a boilerplate for React and Node, with the following root folder structure: - (root level) - client - src - public - package.json - ... - package.json - server.js - node_module ...

What is the best way to access the complete data state of the MUI Data Grid?

Is there a way to retrieve the state object of a MUI Datagrid data? This includes the original data that was populated, as well as any edits that have been made. The state object must be accessible because the data can be exported as .csv. However, I am i ...

React Native: How to Handle Overlapping Elements Without Using Third-party Libraries

Let me clarify that I am not in favor of using any external libraries to address this issue. The problem I am facing involves overlapping elements, which can be seen in the screenshots below: https://i.sstatic.net/g5aog.jpg https://i.sstatic.net/5RVWS.jp ...

Whenever I attempt to include state in a React class that is declared as a constant, I consistently encounter the error message: "TypeError:

Apologies for the redundancy, but as a newcomer to React, I previously inquired about a similar issue and have since modified my code. My current challenge involves trying to access a state value within a const React class. Below is the excerpt from my Ar ...

Vite React encounters a sourcemap warning when using the "use client" feature

I am working with turborepo using React (Vite) and NextJS, and I have shared components within the workspace. I have configured it to use server components, but this causes Vite to display a warning during build: ../../packages/ui/src/components/ui/alert- ...

When using a Redux action type with an optional payload property, TypeScript may raise complaints within the reducer

In my react-ts project, I define the following redux action type: type DataItem = { id: string country: string population: number } type DataAction = { type: string, payload?: DataItem } I included an optional payload property because there are tim ...

The file browser fails to open following an AJAX request in the Firefox browser

I am encountering an issue where the programmatic click on a file input does not open the file browser in Firefox after a successful AJAX call, although it works perfectly in Chrome. The problem persists on version 82.0.3 (64-bit) of Mozilla Firefox for Ub ...

The dynamic relationship between redux and useEffect

I encountered a challenge while working on a function that loads data into a component artificially, recreating a page display based on the uploaded data. The issue arises with the timing of useEffect execution in the code provided below: const funcA = (p ...

What methods can be used to crop and style images in a similar manner using html and css?

Is there a way to replicate this specific method? I attempted to achieve the same look by using CSS masking, but the results weren't pleasing. Does anyone have suggestions on how to accomplish this using HTML/CSS? ...

Updating React Native using setState is not possible

In my React Native application, there is a function that deletes an item: delete(index){ this.setState({deletedIndex:index, cachedCart:this.state.Cart, Cart: this.state.Cart.splice(index,1) }, function(){ console.log(th ...

What is the best way to make my div equal in height to its preceding div sibling?

I want my new div to match the height of the previous one. I'm using percentages for width and height to ensure it displays properly on mobile devices as well. I've tried setting the parent elements to 100% width and height based on suggestions f ...

Is it necessary for all elements of a web application to exist as React components?

It's been more than 2 years since I last worked with React, and revisiting my old code has left me feeling a bit confused. If I were to create an Instagram clone, would it be best to use HTML templates and inject JavaScript like this: <div id="rea ...

Improving React Efficiency: Should You Utilize Memoization of Axios GET Request Using useMemo or useCallback?

My Objective: I am currently working on a sizable function named getUnitedStatesCases, which involves making an Axios GET Request and performing various operations with the received data. I have already implemented it within a useEffect hook upon componen ...

Any ideas on how to successfully implement this CSS text-decoration override?

There are moments when I question my sanity, and today seems to be one of them. Despite what I thought was a straightforward CSS code, it's just not functioning properly. What could I possibly be overlooking? Here is the CSS snippet in question: ul ...

The attribute 'limitTags' is not present in the type 'IntrinsicAttributes & AutocompleteProps'

The Versions of Material UI and Lab I am Utilizing "@material-ui/core": "^4.8.3", "@material-ui/lab": "^4.0.0-alpha.44", Visit the component here Snippet of My Code <Autocomplete multiple limitTags={2} id="multiple-limit-tags" ...

Codepen is a great platform for writing and testing code, but it seems like the top tag

body { background-color: black; } .inner{ margin-left:400px; color:white; width:650px; height:450px; top:130px; position:fixed; padding-left:30px; padding-right:30px; text-align:center; background-color:grey; } .outer { height:50 ...

The hover effect in CSS animations is turned up too high

Check out my Reddit news feed design: https://codepen.io/Teeke/pen/YxXXaE When hovering over articles, the headlines get displayed. But if the article text is too long, part of the headline may go off-screen. Instead of changing the line-height, I' ...