Closed Bug 1440229 Opened 8 years ago Closed 11 months ago

not enough focusing range of developer tool's search

Categories

(DevTools :: Inspector, defect, P3)

58 Branch
defect

Tracking

(firefox58 wontfix, firefox59 wontfix, firefox60 wontfix, firefox142 fixed)

RESOLVED FIXED
142 Branch
Tracking Status
firefox58 --- wontfix
firefox59 --- wontfix
firefox60 --- wontfix
firefox142 --- fixed

People

(Reporter: cs09gi, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Attached image search.png
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20180206200532 Steps to reproduce: I tried to search element's ID on developer's tool. attached file explains, 1. when the keyword is behind horizontal scroll. 2. when the keyword is visible on the screen. Actual results: when the search keyword is right behind of horizontal scroll, it doesn't move the vertical scroll to let it displays on the screen. Expected results: vertical scroll should be moved to make the search result visible on the screen. so user is able to know where the keyword is without scrolling.
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 Build ID 20180226230123 I was able to reproduce this on the latest Firefox release and the latest Nightly using Windows 10 x64, Windows 7 x64, Mac 10.12.6 and Arch Linux x64. I've loaded https://www.mozilla.org/en-US/firefox/60.0a1/whatsnew/?oldversion=58.0.2, opened the Inspector, resized the browser window so that a horizontal scrollbar appeared, searched for "endif" and the third result was displayed under the scrollbar. The issue is only reproducible on Mac if the scrollbars are set to always show.
Status: UNCONFIRMED → NEW
Component: Untriaged → Developer Tools: Inspector
Ever confirmed: true
Priority: -- → P3
Product: Firefox → DevTools
Severity: normal → S3

We're using our scrollIntoViewIfNeeded helper https://searchfox.org/mozilla-release/rev/55854d1d5fea58eb257bedfe707f2228556943a3/devtools/client/inspector/markup/markup.js#1700,1716

showNode(node, { centered = true, slotted, smoothScroll = false } = {}) {
...
      scrollIntoViewIfNeeded(container.editor.elt, centered, smoothScroll);

which uses window.scrollBy
We could probably try to use Element#scrollIntoViewIfNeeded instead, which seems to handle the case from comment 0 just fine

When navigating through search results, we were selecting nodes and scrolling
them into view, centered vertically.
This is not working well in some cases:

  • if the node itself is taller than the markup view, we're scrolling in the middle
    of the node and might miss the actual search results
  • if the node is wider than the markup view, since we're not scrolling horizontally,
    we might miss a search result at the very right of the node

To fix those issue, we're taking advantage of nsISelectionController.scrollSelectionIntoView,
putting the first search result Range in the selection so we scroll to the right location.
It's okay to put the Range in the selection since the user can't have any text
selected at this point.

A couple test cases are added to cover this.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Duplicate of this bug: 1955019
Pushed by nchevobbe@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/30daf57a0d52 https://hg.mozilla.org/integration/autoland/rev/c0e8ea9cf124 [devtools] Scroll to first search result matching Range in Markup view. r=devtools-reviewers,jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
QA Whiteboard: [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: