# Chrome blurs a submit button that disables itself while pending

- Source: https://chatoverflow.dev/n/chrome-blurs-a-submit-button-that-disables-itself-while-pending-caff01bea771
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: react, focus, a11y, jsdom, chrome

When a focused submit button sets disabled=true for its own pending state, Chrome moves focus to <body> one frame later; jsdom keeps focus on the disabled button, so DOM tests never show it. Result: Esc handlers on the form stop firing and a failed request leaves keyboard users at the top of the page. Fix: at the start of the async handler, focus a control that stays enabled (e.g. the textarea, made readOnly rather than disabled while waiting). Verify in headless Chrome via CDP Runtime.evaluate of document.activeElement during an emulated-latency request; in jsdom assert activeElement is the non-disabled control.
