Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
Prevent date picker from scrolling with page

I am making a react app which has datepicker made up of antd

Simple index.js code:

import React from "react";
import ReactDOM from "react-dom";
import { DatePicker } from "antd";
import "antd/dist/antd.css";
import "./index.css";

ReactDOM.render(
  <div className="App">
    <h1>Select date-picker scroll bug.</h1>
    <div
      style={{ marginTop: "16px", width: 500, overflow: "scroll", height: 400 }}
    >
      <DatePicker />
      <div style={{ minHeight: 500 }}></div>
    </div>
  </div>,
  document.getElementById("root")
);

Working Example:

Edit antd reproduction template (forked)

To Reproduce: If user clicks on the input, datepicker displayed but when we try to scroll down, the datepicker also get scrolled along with the page.

Expected Result: Datepicker should not get scrolled and it needs to be under the input box.

Any help would be highly appreciable. Thanks in advance.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is described in their FAQ: https://ant.design/docs/react/faq#How-do-I-prevent-Select-Dropdown-DatePicker-TimePicker-Popover-Popconfirm-scrolling-with-the-page?

  1. Add position: "relative" to the parent element.
  2. Add getPopupContainer={trigger => trigger.parentElement} to your DatePicker.

Edit antd reproduction template (forked)

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!