Closed Bug 1375114 Opened 8 years ago Closed 8 years ago

Text appear selected when switching from display:none to display:block

Categories

(Core :: DOM: Selection, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox57 --- wontfix
firefox59 --- fixed

People

(Reporter: flyingrub, Assigned: MatsPalmgren_bugz)

Details

Attachments

(1 file)

The text of the subcategory is selected when we switch display: none to display: block. We change it with a css rules if the parent has a special class. What we tried to fix it : * Add preventDefault in the click listener * Wrap the classList.add in a setTimeout() * If we comment the display none in css no text is selected when adding the class Current Fix : document.getSelection().empty(); just after the add of the class. Bug introduced here : https://bugzilla.mozilla.org/show_bug.cgi?id=1370513
My build is rather up-to-date with central and I forgot to mention that this bug is located in about:telemetry. The source file of about:telemetry are located there : toolkit/content/aboutTelemetry.*
What are the steps to reproduce the problem?
Component: CSS Parsing and Computation → Selection
Flags: needinfo?(flyinggrub)
Steps to reproduce : 1) Build firefox with this patch : https://reviewboard.mozilla.org/r/146220/ 3) Look for the bug number 1375114 and comment the line below 2) Go to about:telemetry and click on the Environment Data section The text of the subsection should appear selected.
Flags: needinfo?(flyinggrub)
Priority: -- → P3
Attached patch fix?Splinter Review
I haven't debugged in detail what happens during the event handling here but I'm guessing that when a click occurs on a section header the selection is collapsed to some node there. Then aboutTelemetry.js handles the event by inserting new content (the subsections) which somehow ends up inside that collapsed selection. That might actually be the correct handling per spec depending on the exact details. Anyway, there's a simpler way to workaround for this than manually resetting the selection from script: just disable selection entirely in the navigation panel. That's what you want, right?
Attachment #8924379 - Flags: review?(flyingrub)
Did you tried this fix? If i remember correctly I already tried to add -moz-user-select: none but it didn't prevent the selection. :/
Yeah, it works for me in a local build on Linux.
My laptop just died so I don't have any way to test your patch...
:chutten could you take a look ?
Flags: needinfo?(chutten)
Attachment #8924379 - Flags: review?(flyingrub)
I'm in transit due to Quantum Launch, but I'm hopeful about this fix. I'll leave the ni? to remind me to try this tomorrow, unless someone else can get to it first...?
Assignee: nobody → mats
Status: NEW → ASSIGNED
Comment on attachment 8924379 [details] [diff] [review] fix? Review of attachment 8924379 [details] [diff] [review]: ----------------------------------------------------------------- This seems to take care of it in my build
Attachment #8924379 - Flags: review+
Flags: needinfo?(chutten)
Flags: needinfo?(flyingrub)
It seems as though :flyingrub is busy elsewhere. :mats, shall we set this to checkin?
Flags: needinfo?(flyingrub)
Flags: needinfo?(mats)
Sounds good to me.
Flags: needinfo?(mats)
Keywords: checkin-needed
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/56f0c8ff41a0 Disable selection entirely in the #categories navigation panel. r=chutten
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Just to say I tested it without moz-user-select: none; and it does not select the text anymore.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: