Closed Bug 988102 Opened 10 years ago Closed 10 years ago

Opening inspector scrolls the content page all the way to the top

Categories

(DevTools :: Inspector, defect, P1)

defect

Tracking

(firefox30 verified, firefox31 verified)

VERIFIED FIXED
Firefox 31
Tracking Status
firefox30 --- verified
firefox31 --- verified

People

(Reporter: bgrins, Assigned: miker)

References

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

STR:

Open a page
Scroll down a bit
Open the inspector panel

Notice that as the body gets highlighted the page gets scrolled to the top.  The scroll position of the page should not change when devtools opens.
I'm guessing this is caused by the box model highlighter landing, in bug 663778.
Depends on: 663778
Priority: -- → P1
The "inspector-open" selection is being ignored as expected, but a "nodeselected" selection is firing immediately after this, causing the default node to get highlighted (and scrolled into view).  The comment in _shouldNewSelectionBeHighlighted indicates that we shouldn't be highlighting at all in this case.

Relevant code is https://mxr.mozilla.org/mozilla-central/source/browser/devtools/markupview/markup-view.js#275 and https://mxr.mozilla.org/mozilla-central/source/browser/devtools/markupview/markup-view.js#285.
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Attached patch highlight-on-open-WIP.patch (obsolete) — Splinter Review
Mike, this _onNewSelection function seems to get called twice when it is opened (once for inspector-open and once for nodeselected.  If you add some logging like this the top of the function:

console.log(selection.reason);
console.trace();

This patch fixes the issue, but breaks the inspector_basic_highlighter test.  I was wondering if you could take a look at it and see if anything sticks out.

The alternative to fix this issue is to remove the scrollIntoView: true on the _brieflyShowBoxModel call, because I can't tell when it is actually scrolling into except for this case, but I'm probably missing something here.
Attachment #8397966 - Flags: feedback?(mratcliffe)
(In reply to Brian Grinstead [:bgrins] from comment #3)
> Created attachment 8397966 [details] [diff] [review]
> highlight-on-open-WIP.patch
> 
> Mike, this _onNewSelection function seems to get called twice when it is
> opened (once for inspector-open and once for nodeselected.  If you add some
> logging like this the top of the function:
> 
> console.log(selection.reason);
> console.trace();
> 
> This patch fixes the issue, but breaks the inspector_basic_highlighter test.
> I was wondering if you could take a look at it and see if anything sticks
> out.
> 
> The alternative to fix this issue is to remove the scrollIntoView: true on
> the _brieflyShowBoxModel call, because I can't tell when it is actually
> scrolling into except for this case, but I'm probably missing something here.

Failing test log: https://tbpl.mozilla.org/php/getParsedLog.php?id=36811991&tree=Try
Taking this from Brian.
Assignee: bgrinstead → mratcliffe
Attachment #8397966 - Flags: feedback?(mratcliffe) → feedback+
I don't understand why we would ever need scrollIntoView as it is likely to cause way more problems than it solves.

I have removed the scrollIntoView option and everything appears to work fine. If we really need that option then it should be added to the markup view context menu.

Try:
https://tbpl.mozilla.org/?tree=Try&rev=0464270710ab
Attachment #8397966 - Attachment is obsolete: true
Attachment #8404732 - Flags: review?(bgrinstead)
(In reply to Michael Ratcliffe [:miker] [:mratcliffe] from comment #7)
> Created attachment 8404732 [details] [diff] [review]
> highlight-on-open-988102.patch
> 
> I don't understand why we would ever need scrollIntoView as it is likely to
> cause way more problems than it solves.
> 
> I have removed the scrollIntoView option and everything appears to work
> fine. If we really need that option then it should be added to the markup
> view context menu.

Agreed.
Attachment #8404732 - Flags: review?(bgrinstead) → review+
https://hg.mozilla.org/mozilla-central/rev/5033a4da6a1e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 31
Comment on attachment 8404732 [details] [diff] [review]
highlight-on-open-988102.patch

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 663778
User impact if declined: The content page will scroll to the top after opening the inspector panel in devtools
Testing completed (on m-c, etc.): Been on m-c since 4-14
Risk to taking this patch (and alternatives if risky): Low risk, just prevents scrolling to the selected element when it is selected in DevTools
String or IDL/UUID changes made by this patch:
Attachment #8404732 - Flags: approval-mozilla-aurora?
Attachment #8404732 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
QA Whiteboard: [good first verify]
Hi,

I was able to reproduce and verify it successfully on:

- Windows 7 x86_64: reproduced on 31.0a1 BuildID 20140326030203 and verified the fix on latest Beta 30.0 ID:20140520115057 and Aurora 31.0a2 (2014-05-21) 
- Debian Linux x86_64: reproduced on 31.0a1 BuildID 20140326030203 and verified the fix on latest Beta (30.0 ID:20140520115057) and Aurora 31.0a2 (2014-05-21)

As these are 2 platforms out of 3 I think it's safe to mark it as Verified.

Cheers,
Francesca
Status: RESOLVED → VERIFIED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: