Repository: next.js
Issue: The focus of the input is lost when typing quickly.
Labels: bug

### Link to the code that reproduces this issue

[codesandbox](https://codesandbox.io/p/devbox/old-tdd-rwgxft?file=%2Fcomponent%2FMathInput.js%3A5%2C35&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clpb03g4c00092v6ipzrh33ol%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clpb03g4c00032v6ie3hhlsz4%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clpb03g4c00062v6i1du2g3s0%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clpb03g4c00082v6itopo9f7m%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clpb03g4c00032v6ie3hhlsz4%2522%253A%257B%2522id%2522%253A%2522clpb03g4c00032v6ie3hhlsz4%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clpb0bd6s00032v6i89jdg69m%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A5%252C%2522startColumn%2522%253A35%252C%2522endLineNumber%2522%253A5%252C%2522endColumn%2522%253A35%257D%255D%252C%2522filepath%2522%253A%2522%252Fcomponent%252FMathInput.js%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clpb0bd6s00032v6i89jdg69m%2522%257D%252C%2522clpb03g4c00082v6itopo9f7m%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clpb03g4c00072v6ivrgzqggh%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_PORT%2522%252C%2522taskId%2522%253A%2522dev%2522%252C%2522port%2522%253A3001%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clpb03g4c00082v6itopo9f7m%2522%252C%2522activeTabId%2522%253A%2522clpb03g4c00072v6ivrgzqggh%2522%257D%252C%2522clpb03g4c00062v6i1du2g3s0%2522%253A%257B%2522id%2522%253A%2522clpb03g4c00062v6i1du2g3s0%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clpb03g4c00042v6in4bv7d37%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522dev%2522%257D%252C%257B%2522id%2522%253A%2522clpb03g4c00052v6iw0n3pp24%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522clp1zlxc1000gedjw0kvy7j6h%2522%257D%255D%252C%2522activeTabId%2522%253A%2522clpb03g4c00042v6in4bv7d37%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)

### To Reproduce

Type quickly with your mobile browser

### Current vs. Expected behavior

Current: 
Type quickly with your mobile browser, and the focus of the input will be lost. However, in react everything works fine.
Expected:
The input of the focus should be kept even if you type quickly

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
MathLive version 0.97.2

Operating System iOS 17.1.1

Browser Safari

Framework Next 14.0.3
```


### Which area(s) are affected? (Select all that apply)

Not sure

### Additional context

Type quickly with your mobile browser, and the focus of the input will be lost. However, in react everything works fine.

https://user-images.githubusercontent.com/109644973/285171180-16aab2ca-7db4-4720-ac1e-5082de614ed6.mp4


sometimes, it will show the error below
![image](https://github.com/vercel/next.js/assets/45161984/879e816b-69ad-414d-8f80-cf2f51718346)