Closed Bug 2011102 Opened 5 months ago Closed 5 months ago

No caret in textarea when focused via Tab key

Categories

(Core :: DOM: Editor, defect)

Firefox 147
defect

Tracking

()

VERIFIED FIXED
149 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- wontfix
firefox147 --- wontfix
firefox148 --- verified
firefox149 --- verified

People

(Reporter: bugzilla.mozilla.org-3, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

When a <textarea> is focused via the Tab key, there is no visible caret, until I start typing or click in the field.

Steps to reproduce

  1. Open this URL in Firefox: data:text/html,<input value="foo"><textarea></textarea>
  2. Press Tab to focus the text input field. The field border turns blue, and all text in the field (i.e. “foo") is selected.
  3. Press Tab to focus the textarea.

Expected result

Textarea border changes to blue to indicate focus,, and a blinking caret appears at the beginning of the line.

Actual result

Textarea border changes to blue to indicate focus, but there is no blinking caret. If I start typing or click inside the textarea, the caret appears.

Notes

100% reproducible with Firefox 147.0.1 on macOS 26.1. Works fine in Chrome and Safari.

If I type something in the text field before pressing Tab to focus the textarea, the bug does not occur.
If the text field is empty, the bug does not occur: data:text/html,<input><textarea></textarea>

Possibly related to bug 1307721.

:emilio, since you are the author of the regressor, bug 1887552, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

What fixes the bug is the call in the nsCaret::SetSelection(), the rest
is clean-up so we only have one source of truth for that bit.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f08f98bf25d1 https://hg.mozilla.org/integration/autoland/rev/feecbfebef6b Fix nsCaret visibility when switching from a non-collapsed to a collapsed selection. r=layout-reviewers,dshin
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

Comment on attachment 9538519 [details]
Bug 2011102 - Fix nsCaret visibility when switching from a non-collapsed to a collapsed selection. r=#dom-core

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Relatively recent regression with a simple fix.
  • 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
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Relatively simple patch.
  • String changes made/needed: none
  • Is Android affected?: Yes
Flags: needinfo?(emilio)
Attachment #9538519 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9538519 [details]
Bug 2011102 - Fix nsCaret visibility when switching from a non-collapsed to a collapsed selection. r=#dom-core

Approved for 148.0b5

Attachment #9538519 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [uplift][qa-ver-needed-c149/b148]

Reproduced the issue with Firefox 149.0a1 (2026-01-18) on Windows 11. After following the steps from comment 0, there is no blinking caret displayed in the text field.
The issue is verified fixed with Firefox 148.0b5 from comment 9 and Firefox 149.0a1 (2026-01-20) on Windows 11, macOS 26 and Ubuntu 24. After following the steps from comment 0, there is a blinking caret displayed in the text field.

Status: RESOLVED → VERIFIED
Has STR: --- → yes
QA Whiteboard: [uplift][qa-ver-needed-c149/b148] → [uplift][qa-ver-done-c149/b148]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: