Skip to content

fix(recorder): preserve input events across field changes and stop - #3192

Open
dakjdakd wants to merge 1 commit into
web-infra-dev:mainfrom
dakjdakd:fix/recorder-preserve-input-events
Open

dakjdakd wants to merge 1 commit into
web-infra-dev:mainfrom
dakjdakd:fix/recorder-preserve-input-events

Conversation

@dakjdakd

@dakjdakd dakjdakd commented Sep 24, 2026 •

Copy link
Copy Markdown

Fixes #3191.

The Chrome extension recorder could lose an input when someone moved between fields quickly or stopped immediately after typing. The recorder's 300 ms timer belonged to the whole page, so input in field B replaced a pending event for field A. The extension bridge then had its own 200 ms debounce and sent only the last event it had received. Together, those two batching steps could leave the timeline, and a replay generated from it, without a value the user entered.

The recorder now keeps the latest pending input event and flushes it before a click, when input moves to another element, and during Stop. Consecutive keystrokes in the same field remain batched; the event records the value and timestamp from the input that produced it. Flushing before a click also keeps the input ahead of the action that followed it.

In the bridge, the send window now forwards every unsent event in order instead of forwarding just its last event. Sends are serialized, and Stop waits for the final batch before replying. The bridge also recognizes an updated last event when the recorder optimizer merges consecutive input from the same field. The resulting timeline retains both fields in a quick A-to-B sequence and the last value entered before Stop, so generated replay steps have the inputs they need.

The regression tests cover rapid input across two fields, an input followed immediately by Stop, and delivery of multiple buffered events through the bridge before Stop is acknowledged.

Validation:

  • pnpm run lint
  • pnpm exec nx build @midscene/shared
  • pnpm exec nx build @midscene/recorder-ui
  • pnpm --filter chrome-extension exec rstest run tests/recorder-input.test.ts tests/event-recorder-bridge-input.test.ts (3 tests passed)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Chrome extension recorder drops input events during quick field changes or Stop

1 participant