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

[Bug]: OverflowMenu does not close when clicking on an element inside of an <iframe> #11363

Open
2 tasks done
vmukhachev opened this issue May 8, 2022 · 3 comments
Open
2 tasks done

Comments

@vmukhachev
Copy link

Package

@carbon/react

Browser

Chrome

Package version

17.0.2

React version

17.0.2

Description

see the title

CodeSandbox example

https://codesandbox.io/s/reverent-frog-jydl1q?file=/src/App.js

Steps to reproduce

  1. open the codesandbox link
  2. click on the triple dot to open the menu
  3. click inside of iframe
  4. see that menu is not closed (bug!)
  5. click on the page near the menu button
  6. see that menu is closed

Code of Conduct

@tay1orjones tay1orjones added severity: 1 https://ibm.biz/carbon-severity and removed severity: 1 https://ibm.biz/carbon-severity labels May 16, 2022
@tay1orjones
Copy link
Member

@vmukhachev I think for this you'll need to wrap the OverflowMenu and iFrame in a common ancestor/parent and listen for click events. This click event could then be used to provide the proper value to OverflowMenu's open prop.

Would this work for your use case? In case the codesandbox has issues, I replicated this into stackblitz for further testing https://stackblitz.com/edit/github-4nannp?file=src%2FApp.jsx

@joshblack
Copy link
Contributor

One option could be to look into listening to blur window events and sniffing if the active element is an iframe.

@vmukhachev
Copy link
Author

@tay1orjones, thanks! I have written a similar workaround by listening for the blur on window

I think, current OverflowMenu has the code doing something similar:
https://github.com/carbon-design-system/carbon/blob/main/packages/react/src/components/OverflowMenu/OverflowMenu.js#L427
In case this code will be switched to listen for the "blur" and on the window, it should work for iframes as well.

@tay1orjones tay1orjones added severity: 4 https://ibm.biz/carbon-severity and removed impact: low severity: 3 https://ibm.biz/carbon-severity labels Sep 19, 2022
kennylam added a commit to kennylam/carbon that referenced this issue Jul 30, 2024
)

* chore(skeleton): update skeleton stories to sb v7

* chore(storybook): remove unused var

---------

Co-authored-by: kennylam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ⏱ Backlog
Development

No branches or pull requests

4 participants