Skip to content

call initUIEvent with the correct view - #1306

Open
peterkogo wants to merge 3 commits into
testing-library:mainfrom
peterkogo:fix-event-view
Open

call initUIEvent with the correct view#1306
peterkogo wants to merge 3 commits into
testing-library:mainfrom
peterkogo:fix-event-view

Conversation

@peterkogo

Copy link
Copy Markdown

What

We need to pass window to the UIEvent constructor otherwise event.view will be undefined in the emitted event.

Why

This should fix this erroneously closed issue.
We rely on event.view being defined inside React Flow. This would also fix issues with testing d3-drag.

How

Always pass view: window along with the init parameters.

Checklist

  • [N/A] Documentation
  • Tests
  • Ready to be merged

@codesandbox-ci

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@snowystinger

Copy link
Copy Markdown
Contributor

Logged a bug against Chrome https://issues.chromium.org/issues/545322457
Once that's been addressed we can move forward with this issue.

microsoft/fluentui#20022 (comment) suggests that this should be fixed at the jsdom level. I'm not entirely sure yet if I agree. jsdom doesn't deal in trusted events (except for focus/blur, i'm not sure why), and only in trusted events is the view set according to the spec.

User event would be the level at which to set trusted, but I think that's likely a large undertaking and isn't something I wish to take on right now. But adding the view at this level does seem correct as we can think of the user event flows as trusted.

If you'd like to open an issue with jsdom, we could see what they have to say as well. I've pushed some tests for this that I was working on while getting up to speed.

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

Successfully merging this pull request may close these issues.

UIEvent.view is always null

2 participants