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

Rendering in iframe - clicks don't register #200

Closed
paul-veevers opened this issue Sep 25, 2017 · 4 comments
Closed

Rendering in iframe - clicks don't register #200

paul-veevers opened this issue Sep 25, 2017 · 4 comments

Comments

@paul-veevers
Copy link
Contributor

What you did:

Rendering downshift inside a different window/document to where the Javascript is running - e.g. inside an iframe.

What happened:

Clicks on items don't register.

Reproduction repository:

https://codesandbox.io/s/x2ynm9mojw

Problem description:

It's due to window.addEventListener('mousedown' and window.addEventListener('mouseup' in componentDidMount. Referencing the "correct" window (the one the component is in) solves the problem.

This may sound like a crazy use case, but it's quite common for 3rd party widgets, etc. I haven't tested but I assume the same is happening in a shadow dom.

Suggested solution:

Accept a prop called context or similar that defaults to window. I don't think it's possible to automatically get the parent window of a component?

As a note, there's also a reference to document in getItemNodeFromIndex, which will also need to be changed.

Happy to do a PR if that will help :)

@kentcdodds
Copy link
Member

Hi @paul-veevers!

Yeah, I'd be fine with your suggestion solution! Might even help push #185 along :)

@paul-veevers
Copy link
Contributor Author

paul-veevers commented Sep 26, 2017

See #204

@Rendez
Copy link
Contributor

Rendez commented May 23, 2018

I have the impression that this bug still exists within ShadowDOM. Can someone confirm this?

@kentcdodds
Copy link
Member

@Rendez, if you could provide a reproduction in codesandbox that would be great. If you're able to do that, then please file a new issue.

@kentcdodds kentcdodds reopened this May 23, 2018
@downshift-js downshift-js locked as resolved and limited conversation to collaborators May 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants