Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pickers] When embedded inside iframe focus shifts to top of iframe when clicked #11522

Open
1 task done
harshebuilds opened this issue Dec 26, 2023 · 8 comments
Open
1 task done
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module!

Comments

@harshebuilds
Copy link

harshebuilds commented Dec 26, 2023

Duplicates

  • I have searched the existing issues

Steps to reproduce 🕹

No response

Current behavior 😯

I using Date Picker from MUiX. And have embedded it in iframe on wordpress. When I click on the date picker icon to select date, the focus shifts to the top of the iframe.

Expected behavior 🤔

The focus should not shift from the date picker

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords:

@harshebuilds harshebuilds added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 26, 2023
@danilo-leal danilo-leal transferred this issue from mui/material-ui Dec 27, 2023
@danilo-leal danilo-leal changed the title [MuiX DatePicker] When embedded inside iframe focus shifts to top of iframe when clicked on DatePicker [Date Picker] When embedded inside iframe focus shifts to top of iframe when clicked Dec 27, 2023
@danilo-leal danilo-leal added the component: DatePicker The React component. label Dec 27, 2023
@LukasTy
Copy link
Member

LukasTy commented Dec 27, 2023

Hello @prem-2301. Thank you for opening this issue.
I tried replicating your case, but I wasn't able to experience the same problem.
Could you provide a minimal reproduction example so that we could investigate the problem? 🤔
A repository could work very well in this case.

I've tried with the following setup:

import * as React from "react";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { Router, Routes, Route, Link } from "react-router-dom";
import { createBrowserHistory } from "history";

function BasicPicker() {
  return (
    <>
      Some random text
      <LocalizationProvider dateAdapter={AdapterDayjs}>
        <DatePicker label="Basic date picker" />
      </LocalizationProvider>
    </>
  );
}

export default function PickerInIframe() {
  const history = createBrowserHistory();
  return (
    <Router location={history.location} navigator={history}>
      <Routes>
        <Route
          key="home"
          path="/"
          element={'Home'}
        />
        <Route
          key="iframe"
          path="pickers-frame"
          element={<BasicPicker />}
        />
      </Routes>
      <Link to="/">Home</Link>
      <Link to="/pickers-frame" target="pickers_frame">
        Open iframe
      </Link>
      <iframe name="pickers_frame" title="iFrame" width={500} height={450} />
    </Router>
  );
}

@LukasTy LukasTy added status: waiting for author Issue with insufficient information component: pickers This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer component: DatePicker The React component. labels Dec 27, 2023
@LukasTy LukasTy changed the title [Date Picker] When embedded inside iframe focus shifts to top of iframe when clicked [pickers] When embedded inside iframe focus shifts to top of iframe when clicked Dec 27, 2023
@harshebuilds
Copy link
Author

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Dec 28, 2023
@LukasTy
Copy link
Member

LukasTy commented Dec 29, 2023

Thank you for providing a reproduction example. 👍
I could reproduce it using a minimal example with two separate pages locally.
But what browser are you experiencing this issue on?
For me, it was only Firefox that was exhibiting this behavior... 🤷

I also found the same question on StackOverflow.

@LukasTy LukasTy added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 29, 2023
@harshebuilds
Copy link
Author

Hi, I looked into the stack solution but there's no such prop for DesktopDatePicker. Also, this issue is replicating on all browsers for us (Edge, Chrome, Brave)

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jan 2, 2024
@LukasTy
Copy link
Member

LukasTy commented Jan 2, 2024

Thank you for your confirmation regarding browsers. 👌

Hi, I looked into the stack solution but there's no such prop for DesktopDatePicker

Yes, such an exact prop does not exist and it's not that I would recommend the suggested solution, because it's just bad UX and a11y. 🙈

@LukasTy LukasTy added bug 🐛 Something doesn't work and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 2, 2024
@harshebuilds
Copy link
Author

The thing we identified was the focus is shifting to top because of some inset property to the class MuiPopper-root (I might be wrong)

PFA a screenshot for the same
Screenshot 2024-01-02 181649

@harshebuilds
Copy link
Author

Is there any update?

@Baruch-G
Copy link

Baruch-G commented Aug 11, 2024

@prem-2301 , I have the exact same issue. have you found a solution by any chance ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

4 participants