Closed Bug 1981968 Opened 4 months ago Closed 4 months ago

moz-input-{text,search} value attribute is a bit footgunny.

Categories

(Toolkit :: UI Widgets, task, P3)

task

Tracking

()

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

(Reporter: emilio, Assigned: mlucks, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [recomp] [lang=js])

Attachments

(1 file)

MozInputText and subclasses use a public value member to track the current input value:

https://searchfox.org/mozilla-central/rev/202069c4c5113a1a9052d84fa4679d4c1b22113e/toolkit/content/widgets/moz-input-text/moz-input-text.mjs#31,43

Instead of forwarding to the real input. That causes code like input.value = "foo" from an external consumer to not behave as expected. It changes the internal state of MozInputText, but it doesn't get reflected in the <input> element.

The issue is caused by not using .value here: https://searchfox.org/mozilla-central/rev/b3386c22cefca2225cf190522b1862c12765d1ba/toolkit/content/widgets/moz-input-text/moz-input-text.mjs#54

Could be prevented in the future by using: https://github.com/43081j/eslint-plugin-lit/blob/master/docs/rules/no-value-attribute.md

:hjones, here's that needinfo you requested for creating a bug for the eslint no value attribute rule.

Flags: needinfo?(hjones)

To help Mozilla out with this bug, here's the steps:

  1. Comment here on the bug that you want to volunteer to help.
    This will tell others that you're working on the next steps.
  2. Download and build the Firefox source code
    • If you have any problems, please ask on Element/Matrix in the #introduction channel. They're there to help you get started.
  3. Start working on this bug. You will need to update line 56 in moz-input-text.mjs so that it reads .value instead of value.
    • If you have any problems with this bug, please comment on this bug and set the needinfo flag for me by using the "Request information from" checkbox and setting the dropdown select to "mentor". Also, you can find me and my teammates on the #reusable-components channel on Element/Matrix most hours of most days.
  4. Build your change with ./mach build and test your change with ./mach test toolkit/content/tests/widgets/ --headless. Also check your changes for adherence to our style guidelines by using ./mach lint.
  5. Submit the patch (including an automated test, if applicable) for review. Mark me as a reviewer so I'll get an email to come look at your code.
  6. After a series of reviews and changes to your patch, I'll push it to autoland.
  7. ...now you get to think about what kind of bug you'd like to work on next.
    Let me know what you're interested in and I can help you find your next contribution.
Mentor: tgiles
Severity: -- → N/A
Type: defect → task
Keywords: good-first-bug
Priority: -- → P3
Whiteboard: [recomp] [lang=js]
Flags: needinfo?(hjones)
See Also: → 1982463
Assignee: nobody → mlucks
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
QA Whiteboard: [qa-triage-done-c145/b144]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: