chromium/third_party/blink/web_tests/editing/input/password-prevents-dragdrop-onlyselection.html

<!DOCTYPE html>
<html>
  <body>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>

    <div
      id="dragtarget"
      style="background-color: blue; width: 100px; height: 100px">
      Drag here
    </div>
    <div>
      <span id="dragme" draggable="true">Drag me</span>
      <input type="password" id="password_input" value="abc" />
    </div>

    <script>

      // Drag and drop doesn't work well with pointerActionSequence. We need to
      // use eventSender to simulate this. (crbug.com/41316374)
      function moveMouseToCenterOfElement(element) {
        const centerX = element.offsetLeft + element.offsetWidth / 2;
        const centerY = element.offsetTop + element.offsetHeight / 2;
        eventSender.mouseMoveTo(centerX, centerY);
      }

      let isDropped = false;
      const dragMe = document.getElementById("dragme");
      const dragTarget = document.getElementById("dragtarget");

      dragTarget.addEventListener(
        "dragover",
        function () {
          event.dataTransfer.dropEffect = "copy";
          event.preventDefault();
        },
        false
      );
      dragTarget.addEventListener(
        "drop",
        function () {
          isDropped = true;
          event.preventDefault();
        },
        false
      );

      test(function () {
        const e = document.getElementById("dragme");
        const passwordInput = document.getElementById("password_input");

        // Drag the selected text and drop into the '#dragTarget' element.
        x = e.offsetLeft + 10;
        y = e.offsetTop + e.offsetHeight / 2;
        passwordInput.focus();
        eventSender.mouseMoveTo(x, y);
        eventSender.mouseDown();
        eventSender.leapForward(400);
        moveMouseToCenterOfElement(dragTarget);
        eventSender.mouseUp();

        assert_true(isDropped);
      }, "Drag and drop should work on other elements even if the password control is focused.");
    </script>
  </body>
</html>