Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flag for disabling trigger element refocus #287

Open
carton-of-mice opened this issue Nov 24, 2021 · 0 comments
Open

Flag for disabling trigger element refocus #287

carton-of-mice opened this issue Nov 24, 2021 · 0 comments

Comments

@carton-of-mice
Copy link

Thanks to accessibly improvements in v2.0.0 / 16e979a, closing a modal popup resets focus to previously focused element. The element is pulled from document.activeElement when the modal is opening.
This is indeed the desired and expected behaviour most of the time.

But I'm hitting a use case where this is detrimental.
Given a long form (larger than the viewport) and a Submit button at the bottom the page, have said button open a modal (displaying validation issues). This modal features a link to the first field in the form (as an example) and clicking the link should focus/scroll the user to that field.
In this case behaviour after v2.0.0 is - user clicks the link, modal closes while page briefly scrolls to the top, reactjs-popup focuses Submit button, button is brought back into the viewport and user is left confused back at the bottom of the page (and will probably repeat the process).

It would be helpful if there was a way of disabling this behaviour. (this could potentially be lumped in with a solution for #171)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant