Closed Bug 1938110 Opened 11 months ago Closed 11 months ago

Space character being deleted in Gmail composer

Categories

(Core :: DOM: Editor, defect, P1)

defect

Tracking

()

VERIFIED FIXED
135 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox133 --- unaffected
firefox134 --- unaffected
firefox135 + verified

People

(Reporter: overholt, Assigned: masayuki)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

STR

  1. (I'm using a 2024-12-16 Nightly as I file this and will restart to see if it still reproduces) open the Gmail composer
  2. type 'how are you doing' and notice that it offers to complete with the question mark
  3. rather than pressing Tab or typing ?, type space

Expected

  • you get a space

Actual

  • no space character is there

I can still reproduce with a 2024-12-18 Nightly.

Hmm, when I type a white-space, a <br> does not appear after that. However, I cannot reproduce this bug with a simple testcase.

I'll check what occurs within a debug build.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED

Hmm, it could be both bugs of ours and theirs. When I type first white-space when there is ? [tab], we cannot put <br> after the typed white-space since it's followed by ? [tab]. However, after that, there are a lot of empty text nodes after the caret. It seems that that causes our white-space scanner confusing. I try to fix the latter today. Then, let's check the former would still be reproducible.

Ah, the latter is a very minor bug of inserting white-space at invisible trailing white-space at end of the block... Well, I'll try to put <br> by the mutation by the web app.

Okay, I succeeded to hack. I'll post a patch.

Severity: -- → S3
Keywords: regression
OS: Unspecified → All
Priority: -- → P1
Regressed by: 1923251
Hardware: Unspecified → All

Set release status flags based on info from the regressing bug 1923251

Gmail composer puts non-editable <span> to show a suggestion to make
autocomplete feature available. Then, if user types a white-space, Gmail
composer replaces or deletes the non-editable <span>.

When user types a white-space before the non-editable <span>, our editor does
not think that <br> is required to make the white-space visible because of
the following non-editable text. However, it'll be removed asynchronously.
Then, the white-space becomes invisible trailing white-space of the block and
Selection is collapsed after it. Therefore, following editing behaves odd
because our editor does not handle correctly editing in invisible white-spaces.

As you know, Gecko is the only browser to use the ASCII space (U+0020) as a
trailing collapsible white-space immediately before a block boundary.
Therefore, web apps may implement this feature with similar approach without
taking care of Gecko. Therefore, we should use a hack for our uses.

Fortunately, this may occurs only when user appends a collapsible white-space
to end of a Text node. Therefore, HTMLEditor can cache the last Text
node whose last character is recently appended collapsible white-space.
Then, when our mutation observer detects that the white-space becomes invisible,
the mutation observer can put a padding <br> element.

Unfortunately, the <br> is put with the transaction. Therefore, undoing it
deletes only the padding <br> and does not delete the white-space. However,
it's hard to touch transaction management right now. Therefore, this patch
does not fix this issue.

Depends on D231197

Makoto-san, could you review this first rather than the other patches for the editor module? Thanks!

Flags: needinfo?(m_kato)
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/ec81b9013110 Make `HTMLEditor` keep the last typed collapsible white-space visible even after mutations by web apps r=m_kato
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/49794 for changes under testing/web-platform/tests
Flags: needinfo?(m_kato)

The bug is marked as tracked for firefox135 (nightly). However, the bug still has low severity.

:hsinyi, could you please increase the severity for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(htsai)

(In reply to BugBot [:suhaib / :marco/ :calixte] from comment #11)

The bug is marked as tracked for firefox135 (nightly). However, the bug still has low severity.

:hsinyi, could you please increase the severity for this tracked bug? If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

I trusted the setting from Masayuki and we give this P1 to reflect the urgency of landing this.

Flags: needinfo?(htsai)
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
Upstream PR merged by moz-wptsync-bot
See Also: → 1940377

Reproduced the issue described in comment 0 using an old Nightly build from 2024-12-16, verified that using latest Firefox 135.0b8 build across platforms (Windows 11, macOS 13 and Ubuntu 22.04) this is no longer an issue.

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

Attachment

General

Created:
Updated:
Size: