Skip to content

fix: wrap select automatic focus in eventWrapper - #1472

Open
sergioperezcheco wants to merge 1 commit into
testing-library:mainfrom
sergioperezcheco:fix/select-native-focus-act
Open

sergioperezcheco wants to merge 1 commit into
testing-library:mainfrom
sergioperezcheco:fix/select-native-focus-act

Conversation

@sergioperezcheco

Copy link
Copy Markdown

What: Wrap fireEvent.select's existing native focus call in the configured event wrapper. Fixes #1471.

Why: Focus and previous-element blur handlers can update React state. Unlike select and keyup dispatches, the automatic focus was outside act, leaving those updates unflushed and producing warnings.

How: Keep native node.focus() and select → focus → keyup order, but route focus through getConfig().eventWrapper. Regression tests cover inputs, textareas, previous blur, native event ordering and already-focused elements.

Validation: Original production fails two regressions with two passing controls; fixed source tests and rebuilt public exports pass. Node 18/24 with React 18 passed the complete local suite, lint, types, build and formatting. Raw Jest hangs after green tests because this environment's existing MessageChannel shim keeps a scheduler handle alive; an evidence-only native Node setImmediate bridge allowed natural test exit without forceExit. The bridge is not part of this patch. Linux and the complete React latest/canary/experimental CI matrix were not run locally.

Checklist:

  • Documentation added — N/A, existing behavior correction
  • Tests
  • TypeScript definitions updated — N/A, no signature changes
  • Ready for maintainer review

Prepared and validated autonomously using Hermes Agent with OpenAI assistance; no human review is claimed.

Assisted-by: OpenAI via Hermes Agent
Signed-off-by: sergioperezcheco <checo520@outlook.com>
@codesandbox-ci

codesandbox-ci Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 99ba037:

Sandbox Source
react-testing-library-examples Configuration

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.

fireEvent.select does not wrap its automatic native focus in act

1 participant