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

add enableScrollLock prop to dialog component #850

Conversation

ryan-mahoney
Copy link

Support an additional property to the Dialog component named enableScrollLock. If this property is not set, it will default to true (maintaining backward compatibility), but if it is set to false, it will inhibit changing the overflow and paddingRight settings on the of the body tag's style.

This has been the number one requested user-experience change to my application which utilizes the Dialog component. In some cases, it is helpful to be able to scroll the page below the dialog.

@vercel
Copy link

vercel bot commented Oct 5, 2021

@ryan-mahoney is attempting to deploy a commit to the Tailwind Labs Team on Vercel.

A member of the Team first needs to authorize it.

@ryan-mahoney
Copy link
Author

👋 @RobinMalfait can you authorize?

@nicokant
Copy link

Hi, is there any plan on the release of this feature?

@RobinMalfait RobinMalfait deleted the branch tailwindlabs:main November 8, 2021 10:18
@RobinMalfait RobinMalfait reopened this Nov 8, 2021
@RobinMalfait RobinMalfait changed the base branch from main-0 to develop November 8, 2021 11:46
@RobinMalfait RobinMalfait deleted the branch tailwindlabs:main January 17, 2022 13:03
@RobinMalfait RobinMalfait reopened this Jan 17, 2022
@RobinMalfait RobinMalfait changed the base branch from develop to main January 17, 2022 13:06
@mikkelwf
Copy link

Any update on this?

@RobinMalfait
Copy link
Member

Hey! Thank you for your PR!
Much appreciated! 🙏

I'm going to close it for now and revisit it in the future if we ever want to expose an option like this or not.

You should think of a Dialog as a separate page and you should not be able to interact with the contents behind the modal. You could consider it progressive enhancement, but if you rely on the user to be able to scroll the page in the background then this could cause accessibility issues for non-sighted people.

WAI-ARIA best practices state (https://www.w3.org/TR/wai-aria-practices-1.2/#dialog_modal):

A dialog is a window overlaid on either the primary window or another dialog window. Windows under a modal dialog are inert. That is, users cannot interact with content outside an active dialog window. Inert content outside an active dialog is typically visually obscured or dimmed so it is difficult to discern, and in some implementations, attempts to interact with the inert content cause the dialog to close.

Therefore going to close this PR for now. Thanks for your work!

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.

4 participants