Closed
Bug 956530
Opened 11 years ago
Closed 10 years ago
input.select() method not staying selected on multiple clicks
Categories
(Core :: DOM: Selection, defect)
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: impressive.webs, Assigned: ehsan.akhgari)
Details
(Keywords: testcase)
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Steps to reproduce:
Go to this page:
http://jsbin.com/iYOFErAW/1
Click in the text field. Then click outside the text field. Then click again inside the text field.
Actual results:
The first time the field is clicked into, the text is selected (highlighted via the select() method). The 2nd time you click into the field (after clicking outside the field, then back inside again) the text is momentarily selected, then it deselects.
Expected results:
The text should always be selected no matter how many times you click into the text field.
Other browser results:
- Google Chrome has the same bug on all clicks, even the first one.
- IE11 and Opera do not have this bug. They correctly select the text on each click.
Reporter | ||
Comment 1•11 years ago
|
||
FYI, I also wrote a blog post about this issue here:
http://www.impressivewebs.com/input-select-correct-behaviour/
There are brief screencasts showing each browser's behaviour.
Updated•10 years ago
|
Comment 2•10 years ago
|
||
That's .... pretty odd. Ehsan, do you have time to take a look?
Component: DOM: Core & HTML → Selection
Flags: needinfo?(ehsan)
Assignee | ||
Comment 3•10 years ago
|
||
Yes, but it needs to wait until a weekend or something. Taking.
Assignee: nobody → ehsan
Assignee | ||
Comment 4•10 years ago
|
||
What's happening here is that the second time that you click on the text box, we detect that you're clicking on a selection, and set the drag state to false here: <https://dxr.mozilla.org/mozilla-central/source/layout/generic/nsFrame.cpp#2952>, then in HandleRelease, we detect this case <https://dxr.mozilla.org/mozilla-central/source/layout/generic/nsFrame.cpp#3333> and we end up setting the position of the caret forcefully which results in the observed bug. The reason why this bug happens every other time is that the odd times when you click on the text box, we get to this code <https://dxr.mozilla.org/mozilla-central/source/layout/generic/nsFrame.cpp#2958> which causes mouseDown to end up being true in HandleRelease.
Flags: needinfo?(ehsan)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8591256 -
Flags: review?(roc)
Attachment #8591256 -
Flags: review?(roc) → review+
Comment 6•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a766b7f35efa
https://hg.mozilla.org/mozilla-central/rev/b0a131a21f05
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
status-firefox40:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in
before you can comment on or make changes to this bug.
Description
•