Closed Bug 1409560 Opened 7 years ago Closed 6 years ago

Period Key Is Not Delete

Categories

(Calendar :: Tasks, defect)

Lightning 5.4.3
x86_64
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mozilla, Assigned: MakeMyDay)

References

Details

(Keywords: dataloss, Whiteboard: TB 52.6 ESR)

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161213225041

Steps to reproduce:

Thunderbird's Tasks tab was in focus and a task was highlighted.  I pressed the decimal button on the keyboard number pad.  (Num Lock *was* on.)

A second test was setup as above, but I pressed the period key.  (The key with the ">" and "." symbols.)


Actual results:

My task was deleted.


Expected results:

Nothing should have happened.  The period key and decimal keys (when Num Lock is on) are not delete keys!
Keywords: dataloss
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Is this problem 100% reproducible?

Someone remind me which non-numlock options are on those keys, please. :)
(In reply to Andre Klapper from comment #1)
===
> Is this problem 100% reproducible?
===

Yes.  I can delete, at will, a highlighted task by pressing either the decimal key (with Num Lock turned on) or the period key.

===
> Someone remind me which non-numlock options are on those keys, please. :)
===

LOL.  I found this online:  <http://heavens-feel.com/numpad.jpg>
I can confirm this under WindowsXPSP3 TB 52.4 ESR with Lightning 5.4.4.
Thinkpad X61 keyboard, Key with ">" and "." functions as delete when a task is selected in task list view, both in separate tab or side tab, NumLock on and off.
Using Thunderbird 56.0b3 with Lightning 5.8b3 on Windows 10 nothing happens when pressing the decimal key and NumLock is on. With NumLock off the task is deleted - as expected for numeric keypads according to
https://en.wikipedia.org/wiki/Numeric_keypad
https://en.wikipedia.org/wiki/Num_lock#Keys_affected_by_Num_Lock

There are older bug reports like Bug 772439 that state that NumLock is sometimes not working correctly in Thunderbird and Firefox. But the last comment states that the problem was caused by anti-virus software that messed around with the NumLock system settings.
(In reply to Stefan Sitter from comment #4)
===
> Using Thunderbird 56.0b3 with Lightning 5.8b3 on Windows 10 nothing happens
> when pressing the decimal key and NumLock is on.
===

I presume pressing the period key also causes nothing to happen?

===
> There are older bug reports like Bug 772439 that state that NumLock is
> sometimes not working correctly in Thunderbird and Firefox. But the last
> comment states that the problem was caused by anti-virus software that
> messed around with the NumLock system settings.
===

This is definitely a different problem.  With NumLock on, the numerical keys do nothing -- except the number 2 (which would be the down arrow) -- it jumps to the top of the task list.  When NumLock is turned of, the navigation keys under the numbers function as expected.

But then again, my Fedora Linux 26 machine is not running an anti-virus program.  ;-)
(In reply to mozilla from comment #5)
> > There are older bug reports like Bug 772439 that state that NumLock is
> > sometimes not working correctly in Thunderbird and Firefox. But the last
> > comment states that the problem was caused by anti-virus software that
> > messed around with the NumLock system settings.
> ===
> 
> This is definitely a different problem.  With NumLock on, the numerical keys
> do nothing -- except the number 2 (which would be the down arrow) -- it
> jumps to the top of the task list.  When NumLock is turned of, the
> navigation keys under the numbers function as expected.
> 
> But then again, my Fedora Linux 26 machine is not running an anti-virus
> program.  ;-)

Do the keys work as they should in other applications with numlock on?
Flags: needinfo?(mozilla)
(In reply to Wayne Mery (:wsmwk) from comment #6)
===
> Do the keys work as they should in other applications with numlock on?
===

Sorry for the delay in responding.  Yes, the keys work ask they should in all other applications when NumLock is enabled.  Even in Thunderbird, when I'm composing a message, pressing the number pad keys produces numbers and arithmetic signs as they should when NumLock is enabled.  (And when NumLock is disabled, the keys produce the expected cursor movements.)
Flags: needinfo?(mozilla)
Are you seeing the same with Firefox? If so, can you please provide STR?
Flags: needinfo?(mozilla)
(In reply to [:MakeMyDay] from comment #8)
===
> Are you seeing the same with Firefox? If so, can you please provide STR?
===

The keyboard's number pad behaves like it should in Firefox.  I have only seen this behavior (the number keypad's "." button acting as if the NumLock is disabled -- i.e. functioning as the Delete button -- even though the NumLock *is* enabled) in Thunderbird Lightning.

This should be trivial to reproduce.  Are you not seeing it on your test machine?  (I.e. create a task, highlight the task, press the number pad's "." key while NumLock is turned on.)
Flags: needinfo?(mozilla)
Ok, I was able to reproduce this in the task view with an EN-US and a FR keyboard layout on Win10, while a DE layout on the same platform works as expected, even though also the same key is used for deletion if numlock is off in all that layouts.

In an input field in FF, like this comment textbox here, this works as expected also for EN-US and FR. Based on that, the initial report and comment 3 this is a multi-platform issue for several keyboard layouts.

I'm not sure whether this is a core or calendar bug. For now let's track it for calendar, we need some further investigation. 

n.b.: iIn EN-US and FR this key is assocciated to DOM_VK_DECIMAL, while in DE it is DOM_VK_SEPARATOR.
Blocks: ltn62
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Attached patch FixNumlockIssue-V1.diff (obsolete) β€” β€” Splinter Review
Ok, this is limited to the task tree, all other locations where we capture DOM_VK_DELETE are working properly. With the attached patch, I'm no longer able to reproduce the issue. The removal of event.which is not nesseccary for this fix, but as this is deprecated, let's get rid of it.

We should also consider to uplift this for 5.4.6.
Assignee: nobody → makemyday
Status: NEW → ASSIGNED
Attachment #8939167 - Flags: review?(philipp)
Attachment #8939167 - Flags: approval-calendar-esr?(philipp)
Attached patch FixNumlockIssue-V2.diff (obsolete) β€” β€” Splinter Review
Sorry, i didn't update the patch before uploading.
Attachment #8939167 - Attachment is obsolete: true
Attachment #8939167 - Flags: review?(philipp)
Attachment #8939167 - Flags: approval-calendar-esr?(philipp)
Attachment #8939171 - Flags: review?(philipp)
Attachment #8939171 - Flags: approval-calendar-esr?(philipp)
Comment on attachment 8939171 [details] [diff] [review]
FixNumlockIssue-V2.diff

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

I don't really understand this patch, nor why the order of preventDefault/stopPropagation matters. Care to explain?

event.keyCode is also deprecated, can you use event.key instead? Based on the example at https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key it might make sense to check event.defaultPrevented as well, to avoid the double handling.
Attachment #8939171 - Flags: review?(philipp)
Attachment #8939171 - Flags: review-
Attachment #8939171 - Flags: approval-calendar-esr?(philipp)
Attached patch FixNumlockIssue-V3.diff β€” β€” Splinter Review
You're right, the order of stopPropagation and preventDefault doesn't matter. I was just adopting the pattern from the other occurences in the code base where the issue doesn't occur.

I did some further debugging:

Numpad Del Key, all Keyboard layouts, numlock off:
>event.code: NumpadDecimal
>event.key: Delete
>event.keyCode: 46
>event.which: 0
>event.getModifierState('NumLock'): FALSE

Numpad Del Key, Keyboard layout DE, numlock on:
>event.code: NumpadDecimal
>event.key: ,
>event.keyCode: 0
>event.which: 44
>event.getModifierState('NumLock'): TRUE

Numpad Del Key, Keyboard layout INTL (=EN-US) or FR, numlock on:
>event.code: NumpadDecimal
>event.key: .
>event.keyCode: 0
>event.which: 46
>event.getModifierState('NumLock'): TRUE

The different value for event.which in the DE layout seems odd, maybe a bug in core, but given that this property is deprecated, probably nobody cares anymore.

The attached patch moves as requested from event.keyCode and event.which to event.key for the task view. With this applied, all three keystrokes in the handler (delete, space and retrun) are captured as expected, while the NumpadDecimal key doesn't trigger a deletion anymore if numlock is on. There's no need to check event.defaultPrevented upfront here.

I'll file a follow-up bug to do the remaining conversion in calendar code.
Attachment #8939171 - Attachment is obsolete: true
Attachment #8939235 - Flags: review?(philipp)
Comment on attachment 8939235 [details] [diff] [review]
FixNumlockIssue-V3.diff

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

Thanks, looks good! I'm ok to make the order of stopPropagation/preventDefault consistent if you like, I had just thought this magically fixed the issue and was confused.
Attachment #8939235 - Flags: review?(philipp) → review+
Thanks, let's leave it as is.
Keywords: checkin-needed
Comment on attachment 8939235 [details] [diff] [review]
FixNumlockIssue-V3.diff

We should uplift this once it has been in a beta. beta approval request is just in case there will be another 58 beta.
Attachment #8939235 - Flags: approval-calendar-esr?(philipp)
Attachment #8939235 - Flags: approval-calendar-beta?(philipp)
Attachment #8939235 - Flags: approval-calendar-esr?(philipp)
Attachment #8939235 - Flags: approval-calendar-esr+
Attachment #8939235 - Flags: approval-calendar-beta?(philipp)
Attachment #8939235 - Flags: approval-calendar-beta+
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/c24349d92dd8
avoid deletion in task tree if decimal key on the numpad is pressed with numlock on. r=philipp
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 6.1
Beta (TB 58, Calendar 6.0):
https://hg.mozilla.org/releases/comm-beta/rev/903e691f07ce
Target Milestone: 6.1 → 6.0
TB 52.6 ESR, Calendar 5.4.6:
https://hg.mozilla.org/releases/comm-esr52/rev/da5bd978de279a3a6ede0614416f354cae36bbb5

Please create at set target to 5.4.6.
Flags: needinfo?(philipp)
Whiteboard: TB 52.6 ESR
Target Milestone: 6.0 → 5.4.5
Flags: needinfo?(philipp)
Target Milestone: 5.4.5 → 5.4.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: