Closed Bug 1705038 Opened 3 years ago Closed 3 years ago

When dragging recipient input text, uncaught TypeError: event.originalTarget.closest is not a function

Categories

(Thunderbird :: Message Compose Window, defect)

defect

Tracking

(thunderbird_esr78 wontfix)

RESOLVED FIXED
89 Branch
Tracking Status
thunderbird_esr78 --- wontfix

People

(Reporter: thomas8, Assigned: thomas8)

References

Details

Attachments

(1 file)

Starting to drag plain text from a recipient input field causes console error.

STR

  1. compose, type hello into To field (then realize that you wanted to type that into subject)
  2. select and drag hello into subject

Actual

  • console error (89.0a1 (2021-04-12) (64-bit))
Uncaught TypeError: event.originalTarget.closest is not a function
    connectedCallback chrome://messenger/content/mailWidgets.js:2268
mailWidgets.js:2268:47

Expected

  • no console error

Analysis

  • closest() is only available for Element nodes, but originalTarget of selected input text is a text node (hence the error)
  • originalTarget should go away per bug 1699809
  • For our scenario, target when dragging selected plain text will be <html:input> (also when editing pill); need to adjust selector accordingly.

Bug 1705038 - Fix uncaught TypeError when dragging recipient input text. r=aleca

For our dragstart target pill selector (which checks if we're dragging pills):

  • Don't use originalTarget which can be a text node which does not have closest().
  • Make sure that we're not dragging plain text from a pill in editing mode.

Also remove an unnecessary check for an unpredictable number of selected pills.

Attachment #9215741 - Flags: review?(alessandro)
Comment on attachment 9215741 [details] [diff] [review]
1705038_fixRecipientInputTextDragError.diff

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

Looks good, thanks.
Attachment #9215741 - Flags: review?(alessandro) → review+
Target Milestone: --- → 89 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/f6f294aa7802
Fix uncaught TypeError when dragging recipient input text. r=aleca

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Blocks: 1705690
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: