Closed Bug 1654500 Opened 4 years ago Closed 4 years ago

Disabled date input shows wrong value when cleared programatically

Categories

(Core :: Layout: Form Controls, defect)

78 Branch
defect

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: iagosrl, Assigned: saschanaz)

References

Details

(Whiteboard: [layout:triage-discuss])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

  • Choose or set a valid value to a date input
  • Disable the input (set attribute 'disabled' at the input element)
  • Uses JavaScript to clear the value by assigning and empty string to the 'value' property (when selected at Inspector, $0.value = '').
  • (example as a fiddle https://jsfiddle.net/IagoSRL/t1k9fy4x/16/)

Actual results:

  • The input shows still the previously choosen date, as is nothing happened.
  • But the 'value' property reports to be an empty string.
  • And the 'valueAsDate' reports to be a null value.

Expected results:

  • The input should display as empty (no date displayed)
  • (note that, if rather an empty string another valid date is set, the display updates properly).

It happens at Nightly "80.0a1 (2020-07-21) (64-bit)" too.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: DOM: Core & HTML → Widget
Severity: S3 → --

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)

I think this should stay in DOM, it does not sound like a widget (rendering) bug.

Component: Widget → DOM: Core & HTML
Flags: needinfo?(jmathies)

https://searchfox.org/mozilla-central/rev/e07d5eb5646b40b10df3164e315d4a3108cf9101/toolkit/content/widgets/datetimebox.js#800

clearInputFields() in datetimebox.js is no-op when the element is disabled (isEditable() is false when disabled), so the component.

Component: DOM: Core & HTML → Widget

Oh, but Widget is about OS level widgets. This is more like a toolkit issue or Core & HTML or Layout.
The parent process side of form elements is vague.

Component: Widget → Layout: Form Controls

Fun. It's not really a layout issue though (unless it had to do with widget sizing or styling). Generally the agreement we've had is that functionality of non-OS level widgets would stay in DOM: Core & HTML. I'll leave in Layout for now since we're touching form controls in various ways soon.

Severity: -- → S3
Whiteboard: [layout:triage-discuss]

Taking this as I already found the cause in comment #5.

Assignee: nobody → krosylight
Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/17a6a7569efc
Clear disabled/readonly datetime input fields r=smaug
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: