usePreventScroll's iOS keyboard reveal fails under React >= 19.3 in Next.js 16.3
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- next.js, react, typescript
- Lĩnh vực
- accessibility, frontend
Hướng nghiên cứu
Bắt đầu với bản tái hiện Next.js được liên kết tại next-repro/app/SheetDemo.jsx, sau đó so sánh với vite-repro/src/SheetDemo.jsx. Đọc các đường dẫn resize/reveal của useViewportSize và usePreventScroll rồi tái hiện vấn đề trên iOS Safari với React 19.3 trở lên. Được xem là hoàn tất khi input đang được focus được cuộn vào vùng hiển thị lúc bàn phím mở ra mà không làm hỏng hành vi trước đó của React.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 16k
- Fork
- 1.6k
- Merge trung bình
- 3 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của adobe/react-spectrum
-
accessibility bug PreviewTrigger
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
adobe/react-spectrum#10917 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
S2 quiet Picker menu is always 192px wide: its width calc() has no unitCó thể đã có người làm @darshpatel1052 đã nhận 2 ngày trước. Đang mởwaiting on author
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 88/100
adobe/react-spectrum#10909 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DatePicker omits timezone for initially empty fields despite zoned placeholderValueCó thể đã có người làm @mrlexcoder đã nhận 2 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
adobe/react-spectrum#10900 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Separator adds a redundant role="separator" to its default <hr>Có thể đã có người làm @Janani-bn đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
adobe/react-spectrum#10894 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ComboBox with selectionMode="multiple": Cmd/Ctrl+A does nothing while the popover is openCó thể đã có người làm @mangeshraut712 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
adobe/react-spectrum#10866 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của adobe/react-spectrum
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 2 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anomalyco/opencode#62052 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
strapi/design-system#2084 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Report: &TV InternationalĐang mởcheck:passed streams:remove
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
OAuth documentation for GET /api/v2/users/me/ appears inconsistent with required global read scopeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày