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

Portal/Popups incompatible with preact-compat #1969

Closed
jimmed opened this issue Aug 15, 2017 · 5 comments
Closed

Portal/Popups incompatible with preact-compat #1969

jimmed opened this issue Aug 15, 2017 · 5 comments

Comments

@jimmed
Copy link

jimmed commented Aug 15, 2017

TL;DR

When using Popups with preact-compat, the event object passed to handleOpen from the associated Portal does not contain a currentTarget property, due to the way the event object is being cloned. This throws an error, preventing the Popup from being displayed when it is triggered by a mouse event.

Steps

  1. Create an application using preact-cli.
  2. Install semantic-ui-react (and semantic-ui-css) as described in its documentation.
  3. Alias preact-compat in place of React using Webpack, overriding the webpack config using the method described in preact-cli's documentation.
  4. Render a Popup component like so:
const Component = () => <Popup trigger={<p>Hover me</p>} />
  1. Mouse over the rendered component

Expected Result

  • Popup is displayed.

Actual Result

  • Popup is not displayed.
  • Error thrown:
TypeError: Cannot read property `getBoundingClientRect' of undefined

Version

0.71.4

Testcase

Unable to provide test case, unless CodePen allows module aliasing

@layershifter
Copy link
Member

PRs increasing interop with other libraries are very much welcomed. Closing for housekeeping as there are no errors with React and this library is intended to be used with React only.

@jimmed
Copy link
Author

jimmed commented Aug 16, 2017

@layershifter Thanks for the response, and I understand that this is not an intended use case. I've started work on a fix, but won't raise a PR until I have proper test cases established.

@nialloc9
Copy link

I had this issue and fixed it by wrapping my trigger component in a div.

@rkosafo
Copy link

rkosafo commented Feb 7, 2018

I wrapped my triggers component with a div but still getting that getBoundingClientRect with popup using preact. I had to move to preact to correct the issue with input cursor jumping to the end of the text.

@nialloc9 Where you getting this exact error (Cannot read property 'getBoundingClientRect' of undefined at Popup._this.handleOpen (Popup.js:59)) which was fixed by wrapping the component in a div or was it a different error?

@iMerica
Copy link

iMerica commented Aug 16, 2018

Issue persists for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants