Double-clicking doesn't select words across wbr elements
Categories
(Core :: DOM: Selection, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox71 | --- | fixed |
People
(Reporter: roubert, Assigned: nsaffour, NeedInfo)
References
Details
(Keywords: html5, Whiteboard: [post-2.0][good first bug])
Attachments
(4 files)
Updated•14 years ago
|
Comment 2•14 years ago
|
||
Comment 3•14 years ago
|
||
| Reporter | ||
Comment 4•14 years ago
|
||
Comment 5•14 years ago
|
||
Comment 6•14 years ago
|
||
Updated•14 years ago
|
Comment 7•14 years ago
|
||
Updated•14 years ago
|
Comment 8•14 years ago
|
||
Comment 9•14 years ago
|
||
Comment 10•14 years ago
|
||
Comment 11•14 years ago
|
||
Comment 12•14 years ago
|
||
Comment 13•14 years ago
|
||
Comment 14•14 years ago
|
||
Comment 15•14 years ago
|
||
Comment 16•14 years ago
|
||
Comment 17•13 years ago
|
||
Updated•11 years ago
|
Comment 20•6 years ago
|
||
I came across this today and assumed it was a bug. MSDN's technical documents use this html element to make sure their large class names appear nicely on mobile screens, similarly to the java examples above. However when you're on a desktop and double click to copy out the class name, you get a subset of the class name, which has consequences in this scenario, for example if I'm copying out an interface "IService" I end up copying out the implementation "Service" insead.
I think 8 and even 5 years ago this might have been an edge case with few obvious examples, but with the rise of long strings, especially in large text in we pages, #HashTagBugzillaIsCool for example, and the continued rise of use of mobiles internationally, more and more implementations of this html element will appear in the coming years, and Firefox's interpretation of the standard might be subverting the expectations of users and developers alike.
Comment 21•6 years ago
|
||
So if we want to change the behavior here, presumably we should have PeekOffsetWord just return CONTINUE for wbr? Seems like we could do that by just giving wbr a subclass of nsFrame that overrides that one method.
The question is whether this is a desirable change. Anne, David, thoughts?
Comment 22•6 years ago
|
||
If that is what other implementations do that seems reasonable to me. It's unfortunate that selection isn't really maintained standards-wise, but maybe filing an issue against https://w3c.github.io/selection-api/ will resolve that at some point.
<wbr> doesn't seem semantically very different from ­ except that there isn't hyphenation introduced at the break point. So it seems like a reasonable change to me, particularly if it improves compatibility with other browsers. Modulo what Anne said in comment 22 about getting it standardized, of course.
Updated•6 years ago
|
| Assignee | ||
Comment 24•6 years ago
|
||
Can I take this bug?
If yes, can someone point me out where to look?
This is my first bug on Bugzilla so a little help is appreciated :)
Comment 25•6 years ago
|
||
Comment 21 is probably a good place for the starting point, but I'm not 100% sure whether the claim in that comment is true; I am not an expert on the selection code, and comment 21 came after I spent a bit of time trying to read through it...
Unfortunately, it's possible that no one is really an expert on the selection code at this point. Which means this may or may not be good really first bug. ;) That said, if you're willing to deal with a bit of uncertainty, comment 21 is probably the place to start. What you would want to do is change the NS_NewWBRFrame to create an instance of the new nsFrame subclass that has the desired behavior.
| Assignee | ||
Comment 26•6 years ago
|
||
A little uncertainty is always fun :)
I think I should be building a similar class to BRFrame.cpp.
https://dxr.mozilla.org/mozilla-central/source/layout/generic/BRFrame.cpp
Do you think this is correct?
Should I implement all the functions that the BRFRame implement? or only PeekOffsetWorld?
Please correct me if I'm going off track here.
| Assignee | ||
Comment 27•6 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #25)
Comment 21 is probably a good place for the starting point, but I'm not 100% sure whether the claim in that comment is true; I am not an expert on the selection code, and comment 21 came after I spent a bit of time trying to read through it...
Unfortunately, it's possible that no one is really an expert on the selection code at this point. Which means this may or may not be good really first bug. ;) That said, if you're willing to deal with a bit of uncertainty, comment 21 is probably the place to start. What you would want to do is change the
NS_NewWBRFrameto create an instance of the newnsFramesubclass that has the desired behavior.
As far as I can see the 'NS_NewWBRFrame' is already using the 'nsFrame' subclass.
Is there a new version that it should use?
Comment 28•6 years ago
|
||
I think I should be building a similar class to BRFrame.cpp.
Sort of, yes. It doesn't have to be nearly as complicated.
Should I implement all the functions that the BRFRame implement? or only PeekOffsetWorld?
I would expect you only need PeekOffsetWord, but this is the part I am not really sure about. You might need some of the other PeekOffset* functions. You should definitely not need a custom Reflow or any of the size-getting complexity, since you want to leave the existing behavior there.
As far as I can see the 'NS_NewWBRFrame' is already using the 'nsFrame' subclass.
Right, but you want to create a new subclass of nsFrame, which will behave just like nsFrame except for the selection behavior. So you would only override the bits that have to do with selection, which I think are the PeekOffset* bits.
| Assignee | ||
Comment 29•6 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #28)
I think I should be building a similar class to BRFrame.cpp.
Sort of, yes. It doesn't have to be nearly as complicated.
Should I implement all the functions that the BRFRame implement? or only PeekOffsetWorld?
I would expect you only need
PeekOffsetWord, but this is the part I am not really sure about. You might need some of the otherPeekOffset*functions. You should definitely not need a customReflowor any of the size-getting complexity, since you want to leave the existing behavior there.As far as I can see the 'NS_NewWBRFrame' is already using the 'nsFrame' subclass.
Right, but you want to create a new subclass of
nsFrame, which will behave just likensFrameexcept for the selection behavior. So you would only override the bits that have to do with selection, which I think are thePeekOffset*bits.
I think I can make it work from here.
Can I get the bug assigned to me please?
Updated•6 years ago
|
| Assignee | ||
Comment 30•6 years ago
|
||
The wbr element represents a line break opportunity. Before the change double clicking on a text that contains a wbr element did not select the whole sentence.
After the change, the presence of a wbr element in the selection does not affect the selection functionality.
Updated•6 years ago
|
Updated•6 years ago
|
| Assignee | ||
Comment 31•6 years ago
|
||
added tests for Bug 584141 selection across wbr elements
Comment 32•6 years ago
|
||
Comment 33•6 years ago
|
||
Comment 34•6 years ago
|
||
Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=271942929&resultStatus=testfailed%2Cbusted%2Cexception&revision=ab0ed4869416de1b5bc777d97949351c48b61913
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=271942929&repo=autoland&lineNumber=43507
Backout link: https://hg.mozilla.org/integration/autoland/rev/256c7cd198a50aaaeeae2889cdbbc5c8eab2789a
[task 2019-10-18T18:21:44.194Z] 18:21:44 INFO - TEST-PASS | layout/generic/test/test_selection_doubleclick.html | Select across WBR elements with double click: OK
[task 2019-10-18T18:21:44.195Z] 18:21:44 INFO - TEST-PASS | layout/generic/test/test_selection_doubleclick.html | Select across WBR elements using shift and right arrow: OK
[task 2019-10-18T18:21:44.195Z] 18:21:44 INFO - Buffered messages finished
[task 2019-10-18T18:21:44.199Z] 18:21:44 INFO - TEST-UNEXPECTED-FAIL | layout/generic/test/test_selection_doubleclick.html | Select across WBR elements using shift + ctrl + right arrow: OK - got "", expected "abcdef"
[task 2019-10-18T18:21:44.199Z] 18:21:44 INFO - SimpleTest.is@SimpleTest/SimpleTest.js:322:16
[task 2019-10-18T18:21:44.199Z] 18:21:44 INFO - test@layout/generic/test/test_selection_doubleclick.html:53:7
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - setTimeout handlerSimpleTest_setTimeoutShim@SimpleTest/SimpleTest.js:686:43
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - window.onload@layout/generic/test/test_selection_doubleclick.html:74:42
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - EventHandlerNonNull@layout/generic/test/test_selection_doubleclick.html:74:3
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - Not taking screenshot here: see the one that was previously logged
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - TEST-UNEXPECTED-FAIL | layout/generic/test/test_selection_doubleclick.html | Select across WBR elements using shift + ctrl + right arrow: OK - got "", expected "abcdef\nghijkl"
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - SimpleTest.is@SimpleTest/SimpleTest.js:322:16
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - test@layout/generic/test/test_selection_doubleclick.html:63:7
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - setTimeout handlerSimpleTest_setTimeoutShim@SimpleTest/SimpleTest.js:686:43
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - window.onload@layout/generic/test/test_selection_doubleclick.html:74:42
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - EventHandlerNonNull@layout/generic/test/test_selection_doubleclick.html:74:3
[task 2019-10-18T18:21:44.200Z] 18:21:44 INFO - TEST-PASS | layout/generic/test/test_selection_doubleclick.html | Select across WBR elements in paragraph with double click: OK
Please also use a commit message that looks smthg like: | Bug (no) - Add tests for wbr element. r=... | for eg.
Thank you.
Comment 35•6 years ago
|
||
The Mac failure could be due to lines like this:
synthesizeKey("KEY_ArrowRight", {shiftKey:true, ctrlKey:true});
using ctrlKey. On Mac, it's the Option key, not the Ctrl key, that has the "extend the selection by a a word" behavior. If that is what's going on, it's possible that using "accelKey" instead of "ctrlKey" will do the right thing, or maybe it will send Command instead of Option. I can run the test on Mac if that would be useful to see what's going on there.
Comment 36•6 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #35)
The Mac failure could be due to lines like this:
synthesizeKey("KEY_ArrowRight", {shiftKey:true, ctrlKey:true});using ctrlKey. On Mac, it's the Option key, not the Ctrl key, that has the "extend the selection by a a word" behavior. If that is what's going on, it's possible that using "accelKey" instead of "ctrlKey" will do the right thing, or maybe it will send Command instead of Option. I can run the test on Mac if that would be useful to see what's going on there.
Yeah, I highly suspect that is the cause.
I ran try tests on Linux only hoping that would be sufficient, but I was wrong. Sorry for the hassle.
Comment 37•6 years ago
|
||
| bugherder | ||
| Assignee | ||
Comment 38•6 years ago
|
||
I have a small question.
Why does it say that Jeff Walden is the one who wrote this file and it links to to the wrong bug?
https://hg.mozilla.org/mozilla-central/file/tip/layout/generic/WBRFrame.cpp
And its the same thing for many other files in layout/generic
Comment 39•6 years ago
|
||
that field shows the details of "tip" revision (because the URL is for the revision),
and the file body is what you get when you checkout "tip" revision.
you can get the history of the specific file by clicking "revisions" link, or "annotate" link to get the info about which line is modified by who.
| Assignee | ||
Comment 40•6 years ago
|
||
Thank you all for helping me with my first bug :)
Its been a pleasure!
Going to find myself some other bug to work on.
Comment 41•6 years ago
|
||
Verified with the latest Nightly build. In Bug 1477743, “SharedArrayBuffer” in the summary is now entirely selected with a double click. Thank you! 💯
| Reporter | ||
Comment 42•6 years ago
|
||
Verified with the latest Nightly build, very nice, thank you! 👍
Comment 43•6 years ago
|
||
Comment 44•6 years ago
|
||
Backed out changeset 613ca59a8e61 (Bug 584141) for causing tier1 permafails in layout/generic/test/test_selection_doubleclick.html CLOSED TREE
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=272250403&repo=autoland&lineNumber=836
Comment 45•6 years ago
|
||
needinfo because the tests got backed out and need to be fixed/relanded
Updated•6 years ago
|
Comment 47•6 years ago
|
||
Comment 48•6 years ago
|
||
| bugherder | ||
Comment 49•6 years ago
|
||
| bugherder landing | ||
Description
•