The absolute positioned div disappears once it moves beyond the boundaries of its parent container and enters a different container

Exploring the issue further, I have provided examples and a sandbox for better understanding. Take a look at this sandbox link with all dependencies included.

In the image below, you can see that my dropdown menu is hidden behind other elements and only partially visible:

https://i.sstatic.net/tixzD.png

Compare it to how a standard dropdown should appear:

https://i.sstatic.net/6ticc.png

I suspected that the issue might relate to the z-index. Despite setting z-index: 1000;, the element remains invisible, as seen in the inspect screenshot below:

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

Interestingly, there is another dropdown within a header using react-bootstrap that displays correctly even when the header's position is changed from fixed to static, as demonstrated here:

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

I've spent weeks trying to solve this problem without success. Any insights or assistance would be greatly appreciated. Thank you in advance.

import React from "react";
import DataTable from "react-data-table-component";
import DataTableExtensions from "react-data-table-component-extensions";
import "react-data-table-component-extensions/dist/index.css";
import { Dropdown } from "react-bootstrap";

function UsersAdmin() {
  const users = [
    {
      id: 1,
      first_name: "test",
      last_name: "test",
      email: "test",
      mobile: "test",
      avatar: "avatar.png",
      created_at: "2021-11-15T19:14:44.000000Z",
      updated_at: "2021-11-15T19:14:44.000000Z"
    },
    {...}
    {...}
  ];

  const columns = [
    {...}
    {...}
    {...}
  ];

  return (
    <>
      <div className="container-fluid">
        <div className="p-3">
          <h2>{"language item"}</h2>
        </div>
        <div className="card" style={{ width: "100%" }}>
          <div className="card-body">
            <DataTableExtensions exportHeaders columns={columns} data={users}>
              <DataTable
                columns={columns}
                data={users}
                pagination
                defaultSortAsc={false}
                defaultSortField="updated_at"
                noHeader
              />
            </DataTableExtensions>
          </div>
        </div>
      </div>
    </>
  );
}

export default UsersAdmin;

Answer №1

It's not just a matter of z-index. The reason your selection is hidden is because the table container has overflowY set to hidden:

.hkMDrI {
    position: relative;
    width: 100%;
    border-radius: inherit;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
}

As a result, anything outside the height of that div will be hidden.

Considering your current html, it seems unlikely there is a simple solution unless you eliminate scrolling with the table, which may not be ideal.

If I were to make changes to the html, I would suggest placing your .dropdown-menu outside the scrolling div. However, this would require some JavaScript to correctly position the element below the arrow icon.

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

Is there a way to efficiently re-render only the newly added child component while mapping through an array in the Redux state?

Scenario In my application, I am using Redux to manage the state which includes an array of items. Whenever a user clicks on a link in the menu, a new item is added to this array. Within one of my components that is connected to the store using connect(m ...

React JS - CORS error persists despite implementing cors settings

Currently utilizing Express and ReactJS Express Code: const Express = require('express'); const PORT = 5000; const cors = require('cors'); const server = Express(); server.use(cors()); // CORS added here server.get('/users&ap ...

Is it possible for me to traverse a CSS stylesheet using code?

Exploring the depths of jQuery, one can effortlessly traverse the DOM. But what if we could also navigate through a stylesheet, accessing and modifying attributes for the specified styles? Sample Stylesheet div { background: #FF0000; display: blo ...

Blocked: Stripe Connect Embedded Onboarding Popup

I have been diligently following the steps in the tutorial to set up Onboarding with Stripe Connect, which can be found at the following link: After completing all the necessary setup, I encountered an issue where the iFrame containing the "Add Informatio ...

Is my JQuery width() function giving incorrect value results?

Currently, I am facing a situation similar to the following: We have two popup windows that are quite alike. These popups are generated by a factory in JavaScript, allowing them to share common events and functions. One such function is our custom resize ...

React Native continues to prompt for installation of react-native-cli globally

These are the steps I followed to initialize my project: $ git clone ssh:<project> $ cd <project> $ nvm install 5.0 $ nvm use 5.0 I verified that my node version is correct: v5.0.0. $ npm install $ npm install -g react-native-cli Everything ...

What are the steps for implementing the Ionic 2 Pulling Refresher feature in my application?

Hey everyone, I'm currently working on developing a mobile app using AngularJS 2/Ionic2. I am facing an issue with implementing a pull-to-refresh feature in my app. We followed the steps outlined in this link, and while we were able to get the page to ...

Utilizing AJAX to call an HTML file that incorporates JavaScript and CSS components

Currently, I am incorporating AJAX to fetch an HTML file that contains jQuery and JavaScript. Despite already including these scripts on the page, the JavaScript (and CSS) are not running as expected. Any suggestions on how to make my JavaScript function ...

Encountering a null value in my list component variable, resulting in an error when attempting to access properties (specifically 'date')

My list card component showcases various devices with details such as their name, brand, image, and booked status (including how long they are booked for if applicable), all sourced from a Json file. I am facing two challenges: I am looking for a more eff ...

What do the two arrows represent in a higher order function in React using Javascript?

I've been exploring this example HOC function, but I'm struggling to understand the significance of the two arrows, especially the second one where we are de-structuring children and props. const CustomHOC = (InnerComponent) => ({children, .. ...

Is there a way to access and log the state.car.price within my reducer function using console.log

I am facing difficulty accessing a nested property within an object. It's hindering my progress in getting my app operational. const initialState = { additionalPrice: 0, title:"hi", car: { price: 26395, name: '2019 Ford Must ...

The React Redux state has been modified, but the changes are not reflecting in the component's UI

const mapStateToProperties = state => { return { items: state.tabItems }; }; class Application extends Component { render() { return ( <div> <Layout> <Route path="/:item" component={ItemsPag ...

Updating state from multiple handlers using the useReducer hooks in React: a complete guide

Currently, I am utilizing { useReducer } to handle the state of my form. Nonetheless, I have two distinct handlers: handleChange() = used for input changes (this one is functioning as intended) const handleChange = async (e) => { dispatch({fiel ...

Grid items displaying incorrectly due to text alignment issues

I'm facing an issue where I need to separate text and the money part, and also align the text in a way that when viewed in smaller text sizes, the money part moves to the next line. .outdoor-card { display:flex; flex-wrap: wrap; width: 100%; ...

Enclose every line within a span tag

I'm currently exploring ways to wrap each line of content in a span. For example, suppose I have an element structured like this: .body-copy { position: relative; width: 100%; height: auto } <div class="body-copy"> Lorem ipsum dolor s ...

What is the best way to implement media queries in a column layout for a responsive webpage?

My goal is to display a picture below the navbar when the window size becomes small or in mobile mode, followed by my name and other details. However, I am having trouble understanding how to implement this using media queries. DESKTOP PREVIEW https://i. ...

Flask not serving Favicon and images to a React application

I am currently working with a Flask server and have it set up in the following manner: app = Flask(__name__, static_folder="dist/assets", static_url_path='/assets', template_folder="dist") ...

When a user clicks on a specific accordion, the icon for all accordions under mui control will change

My current task involves mapping over an array of data to render multiple controlled accordions. Each accordion should open/close individually upon clicking, but I'm facing an issue where the icons for all accordions are changing when I interact with ...

Encountering a Typescript issue while utilizing day classes from Mui pickers

Recently, I encountered an issue with my code that alters the selected day on a Mui datepicker. I came across a helpful solution in this discussion thread: MUI - Change specific day color in DatePicker. Although the solution worked perfectly before, afte ...

Is it feasible to have multiple versions of React coexisting in a monorepo?

I have a monorepo set up with npm workspaces: ├─ lib │ └─ Foo └─ src ├─ App └─ Web I am looking to upgrade the Web package to React 18 while keeping App on React 17 My current dependencies are as follows: ├─ lib │ └ ...