Closed Bug 1754459 Opened 2 years ago Closed 2 years ago

Images get highlighed when clicked

Categories

(Core :: DOM: Selection, defect, P2)

Firefox 97
defect

Tracking

()

VERIFIED FIXED
100 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox97 - wontfix
firefox98 + wontfix
firefox99 + verified
firefox100 + verified

People

(Reporter: vqrhxw35a, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0

Steps to reproduce:

Open https://www.peopleinside.it/
Click on images they will selected.

See: https://github.com/webcompat/web-bugs/issues/99347

Actual results:

Images are showed selected

Expected results:

Image should be not showed selected

Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
Component: Untriaged → DOM: Selection
Ever confirmed: true
Keywords: regression
Product: Firefox → Core
Regressed by: 1745435

The patch that regresses this says

This patch restores the behavior to select a non-draggable & non-editable image to it was before bug 1550869. That is, we recognize the image selection when the mouse pointer moves passed the middle point of the image width (OffsetsForSingleFrame).

and based on that, I don't think that just clicking an image should be triggering this.

Ting-Yu, could you please look at this case and see what we can do about this? :)

Flags: needinfo?(aethanyc)

[Tracking Requested - why for this release]:

This is a regression in 97, where just clicking an image select-highlights the entire image. This isn't breaking anything, but probably can be considered a minor visual annoyance. Requesting tracking just so this is on your radar.

The images has pointer-events: none that seems to trigger this annoyance. After changing it to default pointer-events: auto, it behaves as expected. I haven't looked into how that can trigger the selection for the image. (keeping the NI as a reminder.)

Thank you!
For avoid this bad Firefox visual in my website I will add the following CSS:

user-select: none;

You should still be able to deactivate this in the browser console and still continue to diagnose and fix this visual issue on Firefox.
For anything I will be here, following this issue until the end.

If you never see "the bug" is because I added

user-select: none;

as temporary fix.

Unlikely we'll do anything to address this out-of-band in Fx97 at this point unless we get more reports of this being more widespread, but let's keep it on the radar for 98 at least.

Severity: -- → S3
Priority: -- → P2

Hi Frank!
This issue has been tracked for Fx 98 and Fx99. However, Ting-Yu is away for two months. Can we have someone else on your team to take this instead? Thank you!

Flags: needinfo?(fgriffith)

I've spoken to Ting Yu about this. He's going to look into it through today and I'll ask Emilio if he can pick it up.

Flags: needinfo?(fgriffith) → needinfo?(emilio)

I think this is an old bug because I can reproduce this on Nightly 2016-01-01. My patch in Bug 1550869 (landed in 2019-06-18) might hide it, and Bug 1745435 reveals it again.

Flags: needinfo?(aethanyc)
Attached file testcase1.html

The testcase is simple: an image with pointer-events: none.

Depends on: 1759866

What saves us in the non-pointer-events: none case is silly, and is
this loop that hits the draggable image:

https://searchfox.org/mozilla-central/rev/fa69d8b248e6c1df670aa6b019e30ec37e6672be/layout/generic/nsIFrame.cpp#4752

Needs tests (if it doesn't affect existing ones), but uploading for some
initial feedback. I think this makes a lot more sense than the existing
code, and works for editing and dragging the same way, so it's nice to
have less special-cases.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Attachment #9268085 - Attachment description: Bug 1754459 - Improve caret position selection for images and other replaced elements. r=TYLin,jfkthame → Bug 1754459 - Improve caret position selection for images. r=TYLin,jfkthame
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/57845918277d
Improve caret position selection for images. r=dholbert
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch

:emilio looks like a good candidate for a beta uplift request for 99?

Flags: needinfo?(emilio)

Comment on attachment 9268085 [details]
Bug 1754459 - Improve caret position selection for images. r=TYLin,jfkthame

Beta/Release Uplift Approval Request

  • User impact if declined: comment 0
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0. Also please re-test that bug 1550869 and bug 1745435 did not regress. I checked manually and we have tests for that but worth sanity-checking if we're going to uplift.
  • List of other uplifts needed: Bug 1759866
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Relatively simple change. This code is a bit gnarly though it's pretty self-contained so I'm mildly confident it won't cause regressions. Behavior also matches other browsers which is good.
  • String changes made/needed: none
Flags: needinfo?(emilio)
Attachment #9268085 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9268085 [details]
Bug 1754459 - Improve caret position selection for images. r=TYLin,jfkthame

Approved for 99.0b7. Thanks.

Attachment #9268085 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

Reproduced the initial issue on Firefox 99 beta 6 on Windows 10 x64.
Verified as fixed on the latest Nightly 100.0a1 on Windows 10 x 66 - the images are no longer highlighted on a single click.
Re-tested also that Bug 1550869 and Bug 1745435 did not regress on the latest Nightly 100.0a1.

Yes seems on Nightly 100.0a1 the issue is resolved.
Thanks.

Verified as fixed on Firefox 99.0b7 on macOS Big Sur 11.6, Windows 10 x64, and Ubuntu 20.04 x64.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+

Thanks for getting this across the line, emilio!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: