Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Cursor Jumps to end of input after component is remounted

Aperta
#207 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Inizia riproducendo il comportamento nell’esempio di Form della documentazione di mr-ui con Form e ControlText, quindi esamina le loro implementazioni e gli utilizzi reali di Form. Il lavoro è completato quando si determina se il remount causa il salto del cursore e si documenta il comportamento osservato oppure si definisce il fix necessario.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Recently this bug came up when using Form with ControlText in what-the-tile:

  • User enters text into the inpute
  • User presses enter (form submits, app handles updated input value and does things)
  • User wants to change the value of the input, places cursor in the middle of the string in the input.
  • User types a character, it appears in the correct place, but the cursor immediately jumps to the end of the input and subsequent characters are typed there.

This is known behavior in react when a controlled input re-mounts: https://stackoverflow.com/questions/45199687/react-input-cursor-moves-to-the-end-after-update

We can see the same behavior in the mr-ui docs example of Form: https://mapbox.github.io/mr-ui/#form

We didn't have a good reason to be using Form so just used ControlText directly to get around this, but I wanted to open an issue to document it in case it comes up again. It might be worth checking places that are implementing Form to see how it behaves in the real world.

Lingua principale
TypeScript
Stelle
90
Fork
5
Merge medio
1g 2h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mapbox/mr-ui

Tutte le issue di mapbox/mr-ui

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.