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

fix: prevent scroll to top on modal close #1313

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dominik-stumpf
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Jun 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
guild-xyz ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2024 8:49pm

@@ -12,7 +12,7 @@ const Modal = ({ children, ...rest }: ModalProps): JSX.Element => {
const transition = useBreakpointValue<any>(transitionValues)

return (
<ChakraModal motionPreset={transition} {...rest}>
<ChakraModal motionPreset={transition} returnFocusOnClose={false} {...rest}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this will disable this accessibility feature for all modals, I think we shouldn't do that. ;)

So the root of the issue is that when we close the modal, the focus returns to the NavMenu. That's incorrect, the focus should just return to the menu item which opens the modal, so could you please just fix the focus management in the edit reward modals? I think you should use the Modal component's finalFocusRef to achieve this behaviour, but not sure if it works with modals inside menus, so we might need to find a workaround for that :S

@dominik-stumpf dominik-stumpf marked this pull request as draft July 1, 2024 14:13
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

Successfully merging this pull request may close these issues.

2 participants