Closed Bug 1318317 Opened 8 years ago Closed 7 years ago

[DateTimePicker] Delete button appears before time values are entered in the input field

Categories

(Toolkit :: UI Widgets, defect)

53 Branch
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla54
Tracking Status
firefox53 --- affected
firefox54 --- verified

People

(Reporter: roxana.leitan, Assigned: jessica)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

Attached file time input.html
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20161115030213

[Affected versions]:
Nightly 53.0a1

[Affected platforms]:
All platforms: Windows 10 x 64, Ubuntu 16.04, Mac OS X 10.11

[Steps to reproduce]:
1.Launch Nightly 53.0a1 with a new profile
2.Set "dom.forms.datetime" pref to True in about:config
3.Open attached html

[Expected result]:
Delete button should be displayed only after any time values are entered in the input field

[Actual result]:
Delete button is displayed before time values are entered in the input field
Assignee: nobody → jjong
Attached patch patch, v1. (obsolete) — Splinter Review
Comment on attachment 8828207 [details] [diff] [review]
patch, v1.

Hi Mike, may I have your review on this small patch? I have also fixed a typo on the reset-button (anoid -> anonid), so now it works correctly.
Attachment #8828207 - Flags: review?(mconley)
Comment on attachment 8828207 [details] [diff] [review]
patch, v1.

Review of attachment 8828207 [details] [diff] [review]:
-----------------------------------------------------------------

Seems okay, though I have one suggestion (see below about moving the reset button click event listener).

It's a bit of a shame that there's no centralized place where we can call updateResetButtonVisibility().

Anyhow, thanks for the patch!

::: toolkit/content/widgets/datetimebox.xml
@@ +1013,5 @@
>                        size="2" maxlength="2"
>                        xbl:inherits="disabled,readonly,tabindex"/>
>          </html:span>
>  
> +        <html:button class="datetime-reset-button" anonid="reset-button"

Yikes. Good catch on that typo.

@@ +1031,5 @@
>          this.mIsPickerOpen = false;
>  
> +        this.mResetButton =
> +          document.getAnonymousElementByAttribute(this, "anonid", "reset-button");
> +        this.mResetButton.addEventListener("click", () => {

Unlike the other events we're adding here, this one doesn't get removed.

Perhaps we should put this in the onClick handler instead if the original target is the reset button, near where we're already checking for it?
Attachment #8828207 - Flags: review?(mconley) → review+
(In reply to Mike Conley (:mconley) from comment #3)
> Comment on attachment 8828207 [details] [diff] [review]
> patch, v1.
> 
> Review of attachment 8828207 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Seems okay, though I have one suggestion (see below about moving the reset
> button click event listener).
> 
> It's a bit of a shame that there's no centralized place where we can call
> updateResetButtonVisibility().

Hmm, you're right, might do that in a follow-up patch.

> 
> Anyhow, thanks for the patch!
> 
> ::: toolkit/content/widgets/datetimebox.xml
> @@ +1013,5 @@
> >                        size="2" maxlength="2"
> >                        xbl:inherits="disabled,readonly,tabindex"/>
> >          </html:span>
> >  
> > +        <html:button class="datetime-reset-button" anonid="reset-button"
> 
> Yikes. Good catch on that typo.
> 
> @@ +1031,5 @@
> >          this.mIsPickerOpen = false;
> >  
> > +        this.mResetButton =
> > +          document.getAnonymousElementByAttribute(this, "anonid", "reset-button");
> > +        this.mResetButton.addEventListener("click", () => {
> 
> Unlike the other events we're adding here, this one doesn't get removed.
> 
> Perhaps we should put this in the onClick handler instead if the original
> target is the reset button, near where we're already checking for it?

Good idea, will provide a new patch to do this.
Attached patch patch, v2.Splinter Review
addressed review comment 3.
Attachment #8828207 - Attachment is obsolete: true
Comment on attachment 8830107 [details] [diff] [review]
patch, v2.

carrying r+.
Attachment #8830107 - Flags: review+
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/f17e441ce4d0
[DateTimeInput] hide reset button when there is no value. r=mconley
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f17e441ce4d0
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170127030206

Verified as fixed using the latest Firefox Nightly 54.0a1 on Windows 10 x64, Ubuntu 16.04 and Mac OS X 10.10.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: