Closed
Bug 1495482
Opened 6 years ago
Closed 4 years ago
Invalid anchorNode when the caret is inside input[type="number"]
Categories
(Core :: DOM: Selection, defect, P2)
Tracking
()
RESOLVED
DUPLICATE
of bug 981248
People
(Reporter: ebert, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
634 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.35 Safari/537.36 Steps to reproduce: Firefox 62 (64-Bit) on Windows 10 (x64) 1. Create an input field that accepts numbers: <input type="number"> 2. Place the caret inside the input field, clicking into it to focus it will do. 3. Open the console and execute this statement: getSelection().anchorNode It returns a "Restricted { }" object instead of the actual input element, this differs from any other text input elements that correctly report the input element. This is an issue when testing the parents, because `.parentNode` will yield 'Error: Permission denied to access property "parentNode"'. Actual results: > getSelection().anchorNode < Restricted { } Expected results: > getSelection().anchorNode < (should show the input element)
Updated•6 years ago
|
Status: UNCONFIRMED → NEW
status-firefox62:
--- → affected
status-firefox64:
--- → affected
Ever confirmed: true
Comment 1•6 years ago
|
||
Can reproduce both in Nightly(64) and in the release channel(62).
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0 Build ID:20181003100127 I manage to reproduce this on Windows 10 x64 with the latest Firefox Nightly 64.0a1 (2018-10-03) (64-bit).
status-firefox63:
--- → affected
Component: Untriaged → Selection
OS: Unspecified → Windows 10
Product: Firefox → Core
Comment 3•6 years ago
|
||
The priority flag is not set for this bug and there is no activity for 2 weeks. :overholt, could you have a look please ?
Flags: needinfo?(overholt)
Comment 4•6 years ago
|
||
Hsin-Yi, can you check into the age of this issue and if we have dupe(s) of it?
Flags: needinfo?(overholt) → needinfo?(htsai)
Comment 5•6 years ago
|
||
I'll try to get back here soon.
Comment 6•6 years ago
|
||
This issue affects Wikipedia's VisualEditor: https://phabricator.wikimedia.org/T209646
Comment 7•6 years ago
|
||
The behaviour of returning a restricted object was showing up in 61. Before 61, the behaviour was somewhat different, it returned null or undefined. I ran mozregression and got this Bug 1447189 that doesn't look relevant here tho... Anyway, I think this should be P2 given comment 6. Edgar, do you think you could help with this? Thank you.
Flags: needinfo?(htsai) → needinfo?(echen)
Priority: -- → P2
Comment 8•6 years ago
|
||
(In reply to Alexander Ebert from comment #0) > Expected results: > > > getSelection().anchorNode > < (should show the input element) Both Goole Chrome and Safari returns the body element, not the input element. In Firefox, getSelection().anchorNode returns body element with other types of input element (datetime, text ..), but console shows "Error: Permission denied .." with number type. And I got the same behavior on Firefox 51.
Comment 9•6 years ago
|
||
We create an anonymous tree for our input element (number type) that is structured as https://searchfox.org/mozilla-central/rev/876022232b15425bb9efde189caf747823b39567/layout/forms/nsNumberControlFrame.cpp#349-360. getSelection().anchorNode returns the element inside the anonymous tree, which is not visible on the content scope.
Comment 10•6 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #8) > (In reply to Alexander Ebert from comment #0) > > Expected results: > > > > > getSelection().anchorNode > > < (should show the input element) > > Both Goole Chrome and Safari returns the body element, not the input element. > > In Firefox, getSelection().anchorNode returns body element with other types > of input element (datetime, text ..), but console shows "Error: Permission > denied .." with number type. And I got the same behavior on Firefox 51. In Firefox, when the focussed node is an <input type=text>, getSelection().anchorNode can be either the node itself, or its parent node, apparently depending on how it got focussed? Attached is a test case that demonstrates the node itself being the Selection anchorNode. (Click the input boxes to focus them and note the output below.) This might be the expected behavior or a separate bug, I don't know.
Updated•6 years ago
|
Assignee: nobody → echen
Flags: needinfo?(echen)
Comment 11•5 years ago
|
||
Bug 981248 tracks removing the silly anonymous input, fwiw.
See Also: → 981248
Comment 12•4 years ago
|
||
Not actively working on this.
Assignee: echen → nobody
Severity: normal → S3
Comment 13•4 years ago
|
||
Hi Kagami, is this something that would also be fixed by bug 1669996?
Flags: needinfo?(krosylight)
Comment 14•4 years ago
|
||
I can't repro this on Nightly, it seems this specific one already has been fixed probably by Emilio in Bug 981248.
Flags: needinfo?(krosylight)
Updated•4 years ago
|
Attachment #9026929 -
Attachment is obsolete: true
Comment 15•4 years ago
|
||
(In reply to Kagami :saschanaz from comment #14)
I can't repro this on Nightly, it seems this specific one already has been fixed probably by Emilio in Bug 981248.
Thanks!
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•