-
Notifications
You must be signed in to change notification settings - Fork 50.3k
Support iframes (nested browsing contexts) in selection event handling #9184
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e1d4110
Use event target doc as getActiveElement context
acusti ed0cc8a
Use node’s window and document when possible
acusti 8f11b2c
Make getting/setting selection check iframe contents
acusti 83cfb55
Add tests for ReactInputSelection
acusti 374d525
Adapt restoreSelection to work for all activeElements
acusti f6f9e35
Tests for getting / restoring selections across iframes
acusti 6ac703f
Add guards for Firefox and Safari compatibility
acusti cec8c3f
Prettier
acusti 0163795
Update test file header
acusti d777546
Avoid causing focus/blur issues from restoreSelection
acusti 7c59a77
Add early return for restoring selection common case
acusti 131357e
Merge remote-tracking branch 'upstream/master' into iframes
acusti 2d4ac46
Prefer active element as element with selection
acusti 5755556
Merge branch 'master' into iframes
acusti b3998eb
Prettier
acusti 174375c
Prevent restoreSelection overwriting active element
acusti 39a9589
Code review-based cleanup and improvements
acusti 82443f7
Detect all valid selection-capable input types
acusti b25279d
Merge branch 'master' into iframes
acusti 026e8f0
Merge branch 'master' into iframes
acusti 689d7c1
Merge branch 'master' into iframes
acusti 074ff51
Guard against null (based on failing test)
acusti 0744710
Linting (var :arrow_right: const)
acusti c71601b
Merge branch 'master' into iframes
acusti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Code review-based cleanup and improvements
- Loading branch information
commit 39a9589618767a3d1ce488479a8bc1957ed49079
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does clipboard data have to do with selection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to do with selection; this is just another part of the codebase that relies on the global
windowobject rather than thewindowobject relative to the DOM node being used. That said, I just looked it up, andwindow.clipboardDatais an IE-only API and one where it seems like the code being executed should only try to look up it’s ownwindow.clipboardData(because of browser permissions / security settings), so I’m going to revert this set of changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah still, do you think it's worth landing? What do you think about sending this out in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t know really know anything about clipboard APIs in IE, but based on a quick google search, my hunch is that this change wouldn’t actually be for the better. There’s some mentions about browser settings and issues with clipboardData not being accessible across different browsing contexts, so keeping it hardcoded to
window.clipboardDatamight actually be correct.But I’d be happy to open a separate PR with it if someone would be able to figure that all out.