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

Modal's Auto Focusing to top of page #89

Closed
hwduncan opened this issue Oct 12, 2018 · 1 comment
Closed

Modal's Auto Focusing to top of page #89

hwduncan opened this issue Oct 12, 2018 · 1 comment

Comments

@hwduncan
Copy link

if (newPage) {
$('[autofocus]:not([data-autofocus=disabled]):first').focus();
if (Config.REDIRECT_SCROLLS_UP) $(window).scrollTop(0);
}

When opening up a modal the parent page automatically focuses to the top of the page. This makes it scroll to the top of the page.
This is fine for most cases however for some modals it is not useful. They are not necessarily new pages and for longer pages when opening a modal the focus will make it jump to the top. After closing, you would then have to scroll back down to where you were.
Can this change so we have the option to prevent this happening for opening a modal? Is there an alternative we could implement so that it doesnt happen for specific modals on our project?

@iPazooki
Copy link
Contributor

@hwduncan To fix this issue please use Config.REDIRECT_SCROLLS_UP = false; in your TS file.

For instance in your case, on your main page add this code Config.REDIRECT_SCROLLS_UP = false; and after that all modal will be opened but you would not experience any scroll to the top.

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

3 participants