window.getSelection() returns null for hidden iframe
Categories
(Core :: DOM: Selection, defect)
Tracking
()
| Webcompat Priority | P3 |
People
(Reporter: timdown, Unassigned)
References
(Blocks 2 open bugs)
Details
(Keywords: testcase, webcompat:platform-bug)
User Story
user-impact-score:135
Attachments
(2 files)
Updated•12 years ago
|
Comment 3•12 years ago
|
||
Updated•5 years ago
|
Comment 4•4 years ago
|
||
P3 from a WebCompat perspective. We've only seen one live site breakage, and we could probably fix this via a site intervention.
Updated•3 years ago
|
Comment 5•1 year ago
|
||
I've just been bitten by this bug using a third-party script library on a page loaded into an iframe inside a Bootstrap modal dialog.
https://github.com/yairEO/tagify/issues/1338
The MDN documentation for getSelection makes no mention of the fact that the method could return null, which to me suggests this behaviour is not expected even if the page is in a hidden iframe.
Checking the document.visibilityState doesn't help, since that returns "visible". Similarly, document.hidden returns false.
Updated•5 months ago
|
Comment 6•5 months ago
|
||
Given the recent webcompat breakage on EBay, this may need re-triage and effort assessment
Comment 7•5 months ago
|
||
You know about selection, right? Do you have an idea of what's going on?
Comment 8•5 months ago
|
||
:sefeng and :denschub are already on it (in Bug 1967389).
Comment 9•5 months ago
|
||
What Boris said in comment 3 is still valid.
Basically we don't have a presShell for display:none, so we don't get a selection.
According to the spec The method must return the selection associated with this if this has an associated browsing context, and it must return null otherwise, selection object should be associated with browsing context, so this is a bug in Firefox.
Looks like one fix we could fix this by moving the selection from presshell to browsing context, which doesn't look hard to do.
Updated•1 month ago
|
Updated•21 days ago
|
Description
•