Closed Bug 1748805 Opened 2 years ago Closed 2 years ago

Error when clicking on "scroll" badge when element causing overflow has pseudo element

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(firefox98 verified, firefox99 verified)

VERIFIED FIXED
98 Branch
Tracking Status
firefox98 --- verified
firefox99 --- verified

People

(Reporter: nchevobbe, Assigned: saihemanth9019, Mentored)

Details

(Keywords: good-first-bug)

Attachments

(2 files)

Steps to reproduce

  1. Navigate to data:text/html,<style>html {max-height: 100px; overflow: auto;} h1 {font-size: 400px;} h1:before{ content: "--";}</style><h1>Hello</h1>
  2. Open the inspector
  3. In the markup view, click on the scroll badge next to the <body> element

Expected results

The <h1> line gets highlighted

Actual results

The <h1> line isn't highlighted, and there's an error:

devtools/client/inspector/markup/views/element-editor.js, line 1058: TypeError: markupContainer.editor.setOverflowHighlight is not a function


This is because for pseudo element, we're using https://searchfox.org/mozilla-central/source/devtools/client/inspector/markup/views/read-only-editor.js , which don't have setOverflowHighlight (unlike devtools/client/inspector/markup/views/element-editor.js )

Mentor: nchevobbe
Severity: -- → S3
Keywords: good-first-bug
Priority: -- → P3

Hi, I've been able to partially reproduce this on Nightly and 96.0.1. As mentioned, the h1 line isn't highlighted on the first click on scroll. However, on increasing window height to a size where h1 fits and decreasing it again, h1 line is highlighted. I'm not sure how it works, so bringing it to your attention if it matters. Attaching a gif for the same.

The fix, I assume, will be to add a stub for this method, similar to getInfoAtNode? Tried it, and this works as expected. Can I be assigned to this bug to send a patch? Are we looking for something else instead? Thanks!

Hello Sai,

I think we should copy what's in https://searchfox.org/mozilla-central/rev/6b4e19ad33650fdf9cd8529cd68eeb98bff1b935/devtools/client/inspector/markup/views/element-editor.js#545-550 in red-only-editor.js (because we do want the line to be in purple)
Then we may update this test https://searchfox.org/mozilla-central/source/devtools/client/inspector/markup/test/browser_markup_scrollable_badge_click.js#121 so it includes a pseudo element and we'd check the line is properly highlighted.

ElementEditor's setOverflowHighlight is called from two places: updateOverflowHighlight and onScrollableBadgeClick.
However, ReadOnlyEditor's setOverflowHighlight is only being called from onScrollableBadgeClick. After copying over the setOverflowHighlight method into ReadOnlyEditor, the pseudo element highlight updates only when the badge is toggled, not when resized.

Flags: needinfo?(nchevobbe)

(In reply to Sai Hemanth from comment #4)

ElementEditor's setOverflowHighlight is called from two places: updateOverflowHighlight and onScrollableBadgeClick.
However, ReadOnlyEditor's setOverflowHighlight is only being called from onScrollableBadgeClick. After copying over the setOverflowHighlight method into ReadOnlyEditor, the pseudo element highlight updates only when the badge is toggled, not when resized.

For now, I'd say let's take care of the issue caused when clicking on the badge. We can take care of the update one later/in another bug as it's not as bad (the error currently stop the highlighting to go on following nodes)

Flags: needinfo?(nchevobbe)
Assignee: nobody → saihemanth9019
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f2e7497ddfd1
Add setOverflowHighlight method to ReadOnlyEditor. r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
QA Whiteboard: [qa-98b-p2]

I was able to reproduce the issue(h1 line is not highlighted) on Win10x64 using 97.0a1 (2022-01-06).
Verified as fixed on Win10/Ubuntu20.4 using builds: 99.0a1(2022-02-24) and 98.0b9 (64-bit).

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: