Closed Bug 1852050 Opened 2 years ago Closed 2 years ago

[Caret browsing] Caret is misaligned on checkboxes in about:preferences

Categories

(Firefox :: Settings UI, defect)

defect

Tracking

()

VERIFIED FIXED
121 Branch
Tracking Status
firefox121 --- verified
firefox122 --- verified
firefox123 --- verified

People

(Reporter: dao, Assigned: emilio)

References

()

Details

Attachments

(2 files, 1 obsolete file)

So I thought the custom checkbox styling messed with the caret positioning when caret browsing is enabled in about:preferences. But from what I've seen, removing the custom styling doesn't fix the caret, so there seems to be something broken on a more fundamental level.

(Anecdotally, caret browsing mode is something that users end up enabling unintentionally, which is a separate problem that we should probably look into at some point.)

The severity field is not set for this bug.
:hiro, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hikezoe.birchill)

Dão, would you mind attaching an example to see the issue? Honestly I don't quite understand what the problem is. And is the problem related to scroll or overflow?

Flags: needinfo?(hikezoe.birchill) → needinfo?(dao+bmo)

(In reply to Hiroyuki Ikezoe (:hiro) from comment #2)

Dão, would you mind attaching an example to see the issue? Honestly I don't quite understand what the problem is. And is the problem related to scroll or overflow?

Here's an screenshot of the issue with the "Open previous windows and tabs" checkbox in about:preferences.

STR:

  1. open about:preferences
  2. enable caret browsing (F7)
  3. put the caret somewhere close to the "Open previous windows and tabs" checkbox
  4. move the caret to the beginning of the "Open previous windows and tabs" label with arrow keys
  5. press the left arrow key one more time
Flags: needinfo?(dao+bmo)

As :dholbert found out (and told to me in #layout Matrix) there's an empty <image class="checkbox-icon"> (which is a zero width element). I guess we don't properly handle such kind of empty elements somewhere in focus or DOM selection area?

Component: Layout: Scrolling and Overflow → DOM: Selection

Also note that :dholbert tried to set pointer-event:none or -moz-user-focus:none to the element, but it doesn't fix the issue. So probably our focus handling is unrelated to this bug, I would say.

(In reply to Hiroyuki Ikezoe (:hiro) from comment #4)

As :dholbert found out (and told to me in #layout Matrix) there's an empty <image class="checkbox-icon"> (which is a zero width element). I guess we don't properly handle such kind of empty elements somewhere in focus or DOM selection area?

Also note: despite its name, that element is not the thing that draws the checkbox icon. I can set display:none on that node or delete it from the DOM entirely, and the checkbox still looks/functions just the same, as far as I can tell.

Looks like that element comes from this JS, written as part of bug 1590573:
https://searchfox.org/mozilla-central/rev/a1827d62f97d9721993ba489f4af7dea422d418f/toolkit/content/widgets/checkbox.js#15

The author Emma isn't active anymore, but emilio reviewed and has poked at this XUL-emulated-in-flex stuff more than anyone -- emilio ,do you know if that element served/serves a purpose?

Flags: needinfo?(emilio)

Er, I guess that commit was just moving code around, and really <image class="checkbox-icon"> came from bug 1455433 which was just migrating from old/analogous XBL which had <xul:image class="checkbox-icon" xbl:inherits="src"/>. Still: emilio is as likely as anyone to know about weird XUL stuff, so I'll leave his needinfo open. :)

I'm not sure at what point in the history this element lost its function, but it's worth exploring whether we can just remove it from the custom-element code, or display:none it away if we need it in some contexts but not in this context...

checkbox-icon is being used in about:preferences#home and about:preferences#sync (in the "Choose What To Sync" dialog).

(In reply to Daniel Holbert [:dholbert] from comment #7)

display:none it away if we need it in some contexts but not in this context...

Yeah, that seems reasonable.

Moving this back to Firefox::Settings UI for now. Thanks!

Component: DOM: Selection → Settings UI
Product: Core → Firefox
Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/02097332c55c Do not display empty checkbox-icons. r=settings-reviewers,Gijs

(In reply to Pulsebot from comment #10)

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/02097332c55c
Do not display empty checkbox-icons. r=settings-reviewers,Gijs

This will probably break the sync icons as they don't use the src attribute: https://searchfox.org/mozilla-central/rev/eadfec923e2b9c927ade8d0dd4f08a82da50a8a9/browser/themes/shared/preferences/preferences.css#851-889

Flags: needinfo?(emilio)

Thanks, asked for a backout... I'll try to figure out a better solution, do those not want the inline margin?

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #12)

Thanks, asked for a backout... I'll try to figure out a better solution, do those not want the inline margin?

They set their own margin: https://searchfox.org/mozilla-central/rev/eadfec923e2b9c927ade8d0dd4f08a82da50a8a9/browser/themes/shared/preferences/preferences.css#821,823
We could just override display there... not great but probably good enough unless this is a pattern we'd want to repeat often.
We could also set the src attribute on those checkboxes.

Attachment #9361168 - Attachment is obsolete: true

(In reply to Dão Gottwald [:dao] from comment #13)

We could just override display there... not great but probably good enough unless this is a pattern we'd want to repeat often.

Yeah I'll do that for now I think. I think <checkbox> being a "leaf" / BaseText element is rather weird fwiw. I think longer term it might be worth it to switch these to use shadow dom, so that we could slot the icon only if needed or what not. But I guess for now this is fine.

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/adbd0d773fe7 Do not display empty checkbox-icons. r=settings-reviewers,desktop-theme-reviewers,dao
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch

I've managed to reproduce the issue using Fx119.0a1.
The issue is verified fixed using Fx 122.0b1, Fx123.0a1 and Fx121.0RC on Windows 10 and Ubuntu 20.04. The caret is no longer going that low between text and checkboxes across different sections of the preferences.

Please note that while this has been fixed, checkbox caret positions still don't seem to be aligned with their respective text caret position.

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

Attachment

General

Created:
Updated:
Size: