Let a text field select from right to left with the mouse (#236)
game-maker / gate (push) Successful in 3m8s
game-maker / suite (push) Successful in 9m36s

Dragging from right to left in a canvas text field only moved the
cursor. The hidden input behind the field got every selection sorted
and without a direction. Its selectionchange echo then handed back the
sorted range, and the anchor jumped to the mouse on the first move.

- KeyboardBridge sets the selection with 'backward' when the focus
  lies before the anchor, and reads selectionDirection when the input
  reports a change.
- TextField passes anchor and focus through unchanged. Its own
  sorting is gone.
- Shift+Left runs through the same path. The cursor should now sit at
  the moving end there too. This is not tested on its own.

Tests:
- ./check.sh: 167 files, 2435 tests, CHECK EXIT 0
- e2e 2: ALL PASSED, 25 checks. New check 2d-ii drags right to left
  in the name field and reads start 0, end 13, direction backward.
- Counter-check without the direction: 2d-ii fails with end 2, the
  reported symptom.
- e2e check total in README goes to 1401 (computed, not run in full).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-26 15:30:33 +02:00
1 parent 74b9c60661
commit 1b3cb625a3
4 files changed
+43 -23

No files matched your search

+18
View File
@@ -105,6 +105,24 @@ export async function inspector(t) {
JSON.stringify((await object('o2')).name),
);
// 2d-ii. A drag from right to left selects the whole name (#236). The hidden input reported its
// range ordered, and its selectionchange echo made the caret the anchor after the first move.
await click(nameLabel.x + 160, nameLabel.y);
const nameField = await json('__gm.focusedRect()');
await press('Escape');
const midY = nameField.y + nameField.h / 2;
await drag(nameField.x + nameField.w - 4, midY, nameField.x + 3, midY);
const backward = await json(
'({ start: document.activeElement?.selectionStart, end: document.activeElement?.selectionEnd,' +
' direction: document.activeElement?.selectionDirection })',
);
await press('Escape');
check(
'dragging from right to left selects the whole name',
backward.start === 0 && backward.end === 'Renamed crate'.length && backward.direction === 'backward',
JSON.stringify(backward),
);
// 2e. Scrub the X field (right of the "X" label) by 100 px.
const xLabel = await locate('X');
await drag(xLabel.x + 160, xLabel.y, xLabel.x + 260, xLabel.y);