usePreventScroll's iOS keyboard reveal fails under React >= 19.3 in Next.js 16.3
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- next.js, react, typescript
- Ambito
- accessibility, frontend
Direzione di ricerca
Inizia con la riproduzione collegata di Next.js in next-repro/app/SheetDemo.jsx, quindi confrontala con vite-repro/src/SheetDemo.jsx. Leggi i percorsi resize/reveal di useViewportSize e usePreventScroll e riproduci il problema su iOS Safari con React 19.3 o versioni successive. Il lavoro è completo quando l'input con il focus viene fatto scorrere nella visualizzazione all'apertura della tastiera senza compromettere il comportamento precedente di React.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Provide a general summary of the issue here
On iOS Safari, tapping a text field inside a Modal that sizes itself from --visual-viewport-height leaves the field hidden behind the keyboard. Nothing scrolls it into view, and nothing errors.
When the keyboard opens, Safari fires one resize event on visualViewport, and two listeners run one after the other:
- useViewportSize, added by react-aria-components on Modal mount. It calls setState, which writes --visual-viewport-height, which grows the sheet's padding and makes the body overflow.
- usePreventScroll's reveal, added when the user tapped the field. It measures the scroller straight away and decides how far to scroll.
So the reveal only works if React commits the first listener's update before the second listener runs. That comes down to which bucket getEventPriority puts resize in.
- react-dom 19.2 and earlier group resize with click. The update flushes in the microtask between the two listeners, so the reveal measures a scroller that has already shrunk and overflows. It scrolls correctly.
- The React 19.3 canary moves resize in with scroll and mousemove (facebook/react#35117). The update now flushes after the whole event finishes. The reveal measures a scroller that has not shrunk yet, so
scrollHeight - clientHeightis still 0, the scroll target gets clamped to 0, andscrollTo({top: 0})does nothing.
🤔 Expected Behavior?
The focused input is correctly scrolled into view
😯 Current Behavior
See above
💁 Possible Solution
I have solved this currently by attaching a visualViewport resize listener, and setting the --visual-viewport-height property directly on the overlay DOM node.
const onResize = () => {
overlayRef.current?.style.setProperty("--visual-viewport-height", `${visualViewport.height}px`);
};
🔦 Context
I have built a RAC Modal sheet component for mobile users. The sheet can contain inputs, and sometimes enough inputs that the sheet can scroll, especially when the keyboard opens. The expectation is that when you focus an input and then the keyboard opens, thereby making the input end up out of the screen due to scroll, the input is scrolled back into view so the user can see what they are typing
🖥️ Steps to Reproduce
Link to repository
Link to nextjs sheet
Link to vite sheet
Version
1.17.0
What browsers are you seeing the problem on?
Safari
If other, please specify.
No response
What operating system are you using?
iOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
- Lingua principale
- TypeScript
- Stelle
- 16k
- Fork
- 1.6k
- Merge medio
- 3g 9h
- PR unite (30g)
- 45
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di adobe/react-spectrum
-
accessibility bug PreviewTrigger
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
adobe/react-spectrum#10917 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
S2 quiet Picker menu is always 192px wide: its width calc() has no unitForse già presa @darshpatel1052 l’ha presa 2 giorni fa. Apertawaiting on author
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 88/100
adobe/react-spectrum#10909 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
DatePicker omits timezone for initially empty fields despite zoned placeholderValueForse già presa @mrlexcoder l’ha presa 2 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
adobe/react-spectrum#10900 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Separator adds a redundant role="separator" to its default <hr>Forse già presa @Janani-bn l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
adobe/react-spectrum#10894 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
ComboBox with selectionMode="multiple": Cmd/Ctrl+A does nothing while the popover is openForse già presa @mangeshraut712 l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
adobe/react-spectrum#10866 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di adobe/react-spectrum
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 2 giorni
-
reproduced
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
anomalyco/opencode#62052 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
strapi/design-system#2084 ·
I maintainer di solito rispondono entro 3 giorni
-
Report: &TV InternationalApertacheck:passed streams:remove
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
OAuth documentation for GET /api/v2/users/me/ appears inconsistent with required global read scopeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno