Skip to content

triple_click does not select text in an input, and no click events reach the page #44

Open

Description

@pallaoro

Summary

computer triple_click on a text input does not select its contents, in both human: true and human: false modes. The caret just lands at the click point. The result still says triple_click at (x, y), so an agent that triple-clicks and then types a replacement ends up inserting text into the middle of the old value.

Hit on a real login form: triple-click on a prefilled email field, then type, produced old-valuenew-valueold-tail.

Environment

  • Daemon 0.2.11, extension 0.2.11 (taskwindow_status reports both up to date)
  • macOS, Chrome, called over MCP

Reproduction

No site code is involved.

  1. tabs_create with url: data:text/html,<input id=e style="position:absolute;left:100px;top:100px;width:400px;height:40px;font-size:20px">
  2. javascript_execute: document.getElementById('e').value = 'name@examplecom'
  3. computer triple_click at (200, 120), with human: false (and again with the default human: true)
  4. javascript_execute: const e = document.getElementById('e'); [e.selectionStart, e.selectionEnd, e.value.length] → [7, 7, 15]. Expected [0, 15, 15].

What the page receives

With listeners on the input and the document, one triple_click (human: false) delivers:

pointerdown  mousedown(detail 1)  pointerup  mouseup(detail 1)
pointerdown  mousedown(detail 2)  pointerup  mouseup(detail 2)
pointerdown  mousedown(detail 3)  pointerup  mouseup(detail 3)

So clickCount 1, 2, 3 does reach the page (humanClick and the instant path in extension/tools/computer.js both increment it). But:

  • no click or dblclick event fires, not even for the first press,
  • the selection never changes; Chrome normally selects the word on mousedown with detail 2 and the whole field on detail 3.

document.hasFocus() is true and visibilityState is visible at the time.

Cause

Not identified. The missing click events suggest Chrome is not treating the pressed/released pair as a click at all, so the selection default action never runs. Worth comparing the Input.dispatchMouseEvent params against a sequence known to produce click (for example buttons on mousePressed, or a preceding mouseMoved to the same point).

Workaround

javascript_execute with el.select(), or form_input with clear: true when the field is reachable by ref or selector.

Related: #41 (Meta+a does not select either, so there is currently no input-level way to select a field's text).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions