Closed Bug 1192486 Opened 6 years ago Closed 6 years ago

[style editor] Selectors, rule names and values are added to Wrong stylesheet if you click autocomplete suggestion in popup

Categories

(DevTools :: Style Editor, defect)

defect
Not set
normal

Tracking

(firefox42 affected, firefox45 fixed)

RESOLVED FIXED
Firefox 45
Tracking Status
firefox42 --- affected
firefox45 --- fixed

People

(Reporter: arni2033, Assigned: tromey)

References

Details

Attachments

(2 files, 1 obsolete file)

STR:   (Win7, Nightly 42.0a1 (2015-08-07))
1. Open data:text/html,<body><style>body{background:tan;}
2. Open Devtools->Style Editor. Press "New"
3. Start typing "bo"   [autocomplete popup "body" will appear]
4. Click that autocomplete item with left mouse button

RESULT:
In just created stylesheet I still see "bo". But if "body" was added to the top of 1st (background) stylesheet. Same applies for names and values of rules

EXPECTATIONS:
Autocompleted string should be in 2nd (active) stylesheed.
Summary: Selectors, rule names and values are added to Wrong stylesheet if you click autocomplete suggestion in popup → [style editor] Selectors, rule names and values are added to Wrong stylesheet if you click autocomplete suggestion in popup
I think the bug here is that AutocompletePopup reuses elements here:

https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/autocomplete-popup.js#56

... but it attaches listeners for each style sheet here:

https://dxr.mozilla.org/mozilla-central/source/devtools/client/shared/autocomplete-popup.js#106

... and doesn't try to filter the click based on which style sheet is selected; so the
click callback is called for the first style sheet.
Assignee: nobody → ttromey
Status: NEW → ASSIGNED
Comment on attachment 8680910 [details] [diff] [review]
make completion work in any selected style editor

This fixes completion by giving each AutocompletePopup its own name.
I didn't see anything readily available to use as a name, so I just
added a counter.
Attachment #8680910 - Flags: review?(mratcliffe)
Comment on attachment 8680910 [details] [diff] [review]
make completion work in any selected style editor

Review of attachment 8680910 [details] [diff] [review]:
-----------------------------------------------------------------

Sorry I took so long to get to this, especially as it is such a simple change.
Attachment #8680910 - Flags: review?(mratcliffe) → review+
Rebased.
Attachment #8680910 - Attachment is obsolete: true
Attachment #8686140 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/9bd35d40fff9
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Has STR: --- → yes
I have reproduced this bug with Firefox Nightly 42.0a1 (Build ID: 20150807030210) on 
windows 8.1 64-bit with the instructions from comment 0.

Verified as fixed with latest Firefox Developer edition 45.0a2 (Build ID: 20160119004010)
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
QA Whiteboard: [bugday-20160120]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.