Closed Bug 1788698 Opened 3 years ago Closed 3 years ago

Input focus not updated properly when type attribute changes

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P2)

defect

Tracking

()

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: issammani, Assigned: emilio)

Details

Attachments

(2 files)

No description provided.

While working on 1767250, we discovered that when the type attribute is mutated onclick from button to text we end up in an undefined focus state, where :focus-visible is not applied but the element is focused.
For context, here is a codesandbox with a minimal reproduction of the issue. When clicking the button, the resulting text input should have the outer focus ring.

I suspect this belongs to Core::Widget, please move back if I'm wrong

Severity: S3 → --
Component: Form Manager → Widget
Priority: P3 → --
Product: Toolkit → Core

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(spohl.mozilla.bugs)

(In reply to Issam Mani [:issammani] from comment #1)

While working on 1767250, we discovered that when the type attribute is mutated onclick from button to text we end up in an undefined focus state, where :focus-visible is not applied but the element is focused.
For context, here is a codesandbox with a minimal reproduction of the issue. When clicking the button, the resulting text input should have the outer focus ring.

If :focus-visible isn't applied but the element is focused, it seems to indicate that the widget-level is working correctly but the front-end fails to apply :focus-visible. This is even more likely if this reproduces on all platforms.

I can't think of the best component for this, so I'm going to assign it to Firefox > General for further triage.

Component: Widget → General
Flags: needinfo?(spohl.mozilla.bugs)
Product: Core → Firefox
Component: General → DOM: UI Events & Focus Handling
Product: Firefox → Core

Emilio could know something about this.

Flags: needinfo?(emilio)
Flags: needinfo?(emilio)

Seems somewhat reasonable to do this, if we wanted to, since
nsFocusManager also makes these always match :focus-visible.

If you think it's worth doing I can add a test quite trivially.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:emilio, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(smaug)
Flags: needinfo?(emilio)

Need to write a test.

Flags: needinfo?(smaug)
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a9df937f8890 Force focus rings when focused input switches to text control. r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36440 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: