Closed Bug 1663475 Opened 4 years ago Closed 3 years ago

CSS clip-path clips keyboard caret on Gecko but not on Blink/WebKit

Categories

(Core :: Layout, defect)

defect

Tracking

()

VERIFIED FIXED
92 Branch
Tracking Status
firefox92 --- fixed
firefox99 --- verified

People

(Reporter: saschanaz, Assigned: emilio)

References

Details

Attachments

(4 files)

Attached file clip-path-caret.html
  1. Open the attachment
  2. See the caret is clipped by clip-path. (It becomes smaller or even invisible inside "bar".)

This currently affects Twitter where emojis use clip-path: circle(0% at center center); which causes carets completely invisible. No such effect on WebKit/Blink.

Emilio, do you mind taking a look? Thanks!

Flags: needinfo?(emilio)

So our behavior here seems pretty reasonable, off-hand. We treat the caret as a normal item in the flow.

Seems like other browsers paint the caret to the containing block. That sounds a bit sketchy because it may not account for transforms and other things in inlines... But maybe it's fine.

This matches other browsers and shouldn't be too terrible, though I'm
not a terrible fan of it.

The patch above needs tests and a try run but seems to work. Btw, I just looked this up afterwards, but this is the relevant Chromium code I think... https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/caret_display_item_client.cc;l=55-69;drc=36c0310725bd6a03de6c11dae1d4986e7e64bb18

Kagami, do you know how Safari behaves? I think our current behavior is not bad, Chrome's feels a bit odd to me and maybe we should just reach out to Twitter.

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

I don't have Safari access but WebKit Windows build behaves same as Blink does. I agree that it's odd though.

Flags: needinfo?(krosylight)

Mats, Masauki, you're familiar with the caret stuff, do you have a strong opinion here?

Flags: needinfo?(mats)
Flags: needinfo?(masayuki)

From point of view of a11y, caret shouldn't be clipped except by the viewport because it's line mouse cursor for users who use caret browsing mode (I don't know how much users use it). On the other hand, caret is representation of a collapsed selection range. Therefore, clipped as same as non-collapsed selection could be consistent behavior in theory. But I don't have strong opinion, just random thoughts.

Flags: needinfo?(masayuki)

From point of view of a11y, caret shouldn't be clipped except by the viewport because it's line mouse cursor for users who use caret browsing mode (I don't know how much users use it).

Well, but if caret is in invisible element, e.g., transparent <textarea>, it could break backward compatibility.

Assignee: nobody → emilio
Attachment #9174457 - Attachment description: Bug 1663475 - Paint caret geometry from the containing block. → Bug 1663475 - Paint caret geometry from the containing block. r=miko,mats
Status: NEW → ASSIGNED
Severity: -- → S3
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5dd5f0d3a09b
Paint caret geometry from the containing block. r=mats
Backout by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ecffe880103c
Backed out changeset 5dd5f0d3a09b for mochitest failure on test_reftests_with_caret.html CLOSED TREE

Do we have some blockers here or the it's just the test to be updated?

I don't recall what the test failure was, but no, the patch should be fine, I'll try to re-land it.

Attachment #9174457 - Attachment description: Bug 1663475 - Paint caret geometry from the containing block. r=miko,mats → Bug 1663475 - Paint caret geometry from the containing block. r=mats
Flags: needinfo?(mats)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ccc6e271d9db
Paint caret geometry from the containing block. r=mats
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
Flags: qe-verify+
Regressions: 1731165

I managed to reproduce this bug on Firefox 89.0(20210527174632) on Win10 64-bits; Confirmed as fixed on Firefox 99.0(20220328190900) and Nightly 100.a1(20220403215202) on Win 10 64-bits, MacOS 10.15 and Linux x86_64(Ubuntu 20.04).

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

Attachment

General

Created:
Updated:
Size: