Bug 1663057 - Expand compose recipient input when long strings are dropped inside. r=mkmelin a=wsmwk
authorAlessandro Castellani <alessandro@thunderbird.net>
Wed, 23 Sep 2020 13:58:20 +0300
changeset 40822 1de9d3a2bc7b95b25728e5376d5931356c29d90b
parent 40821 a97887e1fb0173a361a13175453b246e88fe2175
child 40823 866097a0dbb86706744353cd4b54ec4a5ff1cb95
push id406
push userthunderbird@calypsoblue.org
push dateMon, 19 Oct 2020 19:46:44 +0000
reviewersmkmelin, wsmwk
bugs1663057
Bug 1663057 - Expand compose recipient input when long strings are dropped inside. r=mkmelin a=wsmwk
mail/base/content/mailWidgets.js
--- a/mail/base/content/mailWidgets.js
+++ b/mail/base/content/mailWidgets.js
@@ -2208,16 +2208,29 @@
           addressRow
             .querySelector(".address-container")
             .classList.remove("drag-address-container");
         }
       });
 
       this.addEventListener("drop", event => {
         if (!event.dataTransfer.getData("text/pills")) {
+          // A text string was dropped inside the input field therefore we need
+          // to update its size to fit the new content.
+          let input = event.originalTarget.closest(
+            ".address-input[recipienttype]"
+          );
+          // Trigger this action only if the string was dropped exactly on the
+          // <div> inside the input field.
+          if (input) {
+            input.setAttribute(
+              "size",
+              event.dataTransfer.getData("text/plain").trim().length || 1
+            );
+          }
           return;
         }
 
         // Remove the indicator style for the pill.
         let targetPill = event.originalTarget.closest("mail-address-pill");
         if (targetPill && targetPill.classList.contains("drop-indicator")) {
           targetPill.classList.remove("drop-indicator");
         }