React Nested Menu Selection

Having trouble displaying TextField values in my React app. Utilizing material UI and material-ui-phone-number packages. Noticed that values appear behind when clicking the flag due to zIndex issue. Looking for modifications only on dialog2.js

For code examples, please refer to my codesandbox HERE

https://i.stack.imgur.com/SUz64.jpg

Answer №1

When using your MuiPhoneNumber component, keep in mind that it makes use of a MUI modal for country selection with a default z-index of 1300. Unfortunately, there doesn't seem to be a prop available to customize its CSS properties directly. However, you can still apply your preferred styling solutions by targeting the #country-menu (the modal's ID) like this:

<div>
  <style type="text/css">
    {`
    #country-menu {
      z-index: 1801;
    }
    `}
  </style>
  <DialogContent style={{ width: 300, height: 500 }}>
    <MuiPhoneNumber
      name="MobileNo"
      label="Mobile No."
      variant="outlined"
      fullWidth
      defaultCountry={"vn"}
      value={selectedValue}
      onChange={(e) => setSelectedValue(e)}
    />
  </DialogContent>
</div>

https://codesandbox.io/s/nested-dialog-menuitem-dropdown-forked-68tbq?file=/dialog2.js

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

Encountering an error in React JS: "Attempted to filter an undefined property within an async function."

It appears that my code is straightforward and uses a list as the local state, which gets updated after fetching data. The list loads perfectly in the tbody but becomes undefined inside the handleDelete function. const [list, setList] = useState([]); useE ...

Tips for implementing styling in a material table within a reactjs application

Is there a different way to set the display property to inline-block since cellStyle doesn't seem to recognize it? How can I adjust the width of a specific column, let's say with the name title, without affecting the width of all other co ...

Delay the loading of styled components styles in Next.js

Question regarding the usage of styled components with Next.js, specifically in the following versions: "next": "12.3.1", "styled-components": "^5.3.6" ISSUE: When reloading the localhost page, there is a brief mom ...

CSS-only Tooltip: text is getting truncated

I am experimenting with adding tooltips to my forum posts. Short tooltips work fine, but longer ones are causing issues by cutting off text. Changing the position property from relative to absolute fixes this problem, but causes the text to overlap. Here ...

I would like to hide the button if there are fewer than five visible

When there are less than 5 visible buttons, I want the button to be invisible. The state visible outputs 5 buttons each time. On the detail page, I would like to have the buttons invisible if there are fewer than 5 outputs. In my current code, when ther ...

Could anyone clarify the reason behind the success of one function while the failure of the other?

Currently delving into the world of React, I decided to follow along with the Road To React book. In this guide, the author presented this code const List = (props) => ( props.list.map(item => ( <div key={item.objectID}> & ...

Variation in values across various functions within a state

Currently, I am working on a project using nextjs. I have a custom select component that opens the options when clicked, but I am struggling to figure out how to close it when clicking anywhere else on the screen. The state value seems to be causing some i ...

I am curious about how to implement a feature where clicking on a navigation bar item automatically scrolls the webpage to the corresponding section

Currently, I am utilizing React alongside JavaScript to create a personal portfolio website. I have been exploring ways to achieve smooth scrolling to specific sections on the same page when interacting with the navigation bar. Below is the snippet of cod ...

Guide to setting up index.js with ApiProvider in the Redux Toolkit (RTK)

Have you ever considered customizing the index.js file in the root directory based on ChatGPT's recommendations? I'm not entirely convinced that it's the most common practice. What are your thoughts on this approach? // Here is an example of ...

Easily changing the state of a specific array item using React

I'm having trouble updating the state of a specific item in an array called reviews. Can someone guide me on how to achieve this? The following code snippet is not working as expected: this.setState({ reviews[2].current: true }); Below is the comp ...

Capturing user input for LazyList in Jetpack Compose to display dynamically

I've hit a snag trying to display User input in my LazyList. The User's input is collected via the ModelBottomSheet, but despite attempting to save it, I can't get it to show up in my LazyList. I suspect there might be an issue with how the ...

The correct Loader for managing this specific file format - Next.js

Interestingly, running the command npm run build seems to function properly within the npm module I am developing. It's worth mentioning that this module is focused on MUI Theming and also features some Nextjs components. However, when attempting to ...

The dilemma of calculating the total width of jQuery's list items

I am in the process of creating a submenu that should look like this: HTML: <ul class="mainMenu clearfix"> <li><a href="#">Eurodan huset</a></li> <li><a href="#">Hustyper</a></li> <li&g ...

Encountered an API error when trying to connect to the MongoDB using Apollo-React. The error message reads: "Error: connect ECONNREFUSED

My goal is to set up an API service using Apollo (GraphQL), React, Webpack, and MongoDB on a Windows environment. The service starts successfully, but as soon as I send the first request, the service crashes. The versions I am using are: npm v5.6.0 node ...

How can I assign a background image to a specific state or template using AngularJS?

While attempting to style the entire template with a CSS div tag, I encountered an issue. The code snippet used was: <div ng-style="{'background-image': 'url(/images/food.png)', 'background-repeat': 'repeat-y'}"& ...

Ways to prevent horizontal scrolling in an image

Currently, I am working on a scrolling animation page that is optimized for mobile devices. One issue I am encountering is when an element is larger than the screen size, such as when an image is wider than the mobile device. In this scenario, the user can ...

Creating a distinctive appearance for JavaScript's default dialogue box

Is there a way to enhance the design of my code that prompts the user for input using JavaScript's `prompt`? Currently, it appears too simplistic. Are there any CSS or alternative methods to improve its appearance? function textPrompt(){ var text = ...

Prevent unauthorized entry to css and javascript files

Is there a way to prevent direct access to a file? I want the file to be used on my website, but I want to block it from being accessed directly. For example, if you try to open this link: https://example.com/style.css, you will see an error message. Howev ...

Expanding the size of a textarea using JavaScript

JavaScript: function adjustRows() { var value = document.getElementById("test1").value.length; if (value <= 18) { value.rows = 1; } else if (value > 18 && value < 36) { value.rows = 2; } else if (value > 36 && v ...

Encountering an issue with React Native navigation that says "_this.props.navigation.navigate"

As a beginner in react-native, I decided to create a practice project to learn. My goal was to navigate to another page by tapping on the text inside the drawer. Unfortunately, I encountered an error: TypeError: undefined is not an object (evaluating &apos ...