As a user, in a modal I should be able unset focus from input fields #5176
Replies: 2 comments 1 reply
-
Hi @shashank1010, Thank you for reporting this issue. We will try to fix it at the earliest. |
Beta Was this translation helpful? Give feedback.
-
@Viraj-10 to your comment on issue before making this into a discussion. I believe the link to the snack did reproduce the issue reliably. Imagine a popup window with several fields, such that the modal body scrolls. when you click on the checkbox, the last selected field gets the focus modal body scrolls down to the focused field. |
Beta Was this translation helpful? Give feedback.
-
Description
When you open the modal for this example
https://snack.expo.dev/@shashank1010/modal-checkbox-click-issue
You would notice that the first field has focus.
In this example, I simulated a vertical space with a height of 500px and then there is a checkbox.
When, the first field has focus and you scroll down to click on the checkbox, modal body scrolls up to the first field.
Also, in this case, after scrolling down, if I click on the modal body itself, even then it scrolls up to the first field.
The example in the doc works beautifully, however, only when there is no scroll.
Problem Statement
In a modal that has input fields, scrolling and then clicking outside a field scrolls the modal to the last selected field.
Proposed Solution or API
...
<FocusScope
contain={visible && props.containScope}
.
.
.
.
Alternatives
I've tried all possible hacky solutions to resolve this issue, but the field just keeps retaining focus.
Additional Information
https://snack.expo.dev/@shashank1010/modal-checkbox-click-issue
Beta Was this translation helpful? Give feedback.
All reactions