-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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(VDialog): allow nested elements to overflow scroll #13548
fix(VDialog): allow nested elements to overflow scroll #13548
Conversation
if (isAppWrapper) return false | ||
|
||
const alreadyAtTop = el.scrollTop === 0 | ||
const alreadyAtBottom = el.scrollTop + el.clientHeight === el.scrollHeight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it might be pretty expensive to do recursively on every scroll event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been working alright for me, but yes if you have tons of nested content it could be slow...but since we're overriding default scroll behavior I'm not sure how else to bubble the scroll event up through parents to mimic the default behavior we lost.
I'm definitely open to suggestions, though, if there is a more performant way to do this, or a way to skip elements that don't have the ability to scroll/are not overflowing content.
@KaelWD Sorry for the huge delay in seeing this - for some reason I wasn't getting notifications from GitHub when you left the above feedback for me. |
Description
While the
Overlayable
mixin's scroll listeners are active, itsshouldScroll
method now recursively checks the target element AND its ancestors to evaluate if we should allow the scroll event to go through. The check stops if the element being evaluated has thev-application
class.I originally had this stopping at the first ancestor with class
v-dialog
, but am not sure if there are other components or instances where the overlay is used. It seems to work fine usingv-application
to get the desired effect, though.Motivation and Context
I created a component that has several scrollable elements - some nested - to display analytics/charts/lots of other stuff. When this content is rendered within a v-dialog, you are only able to scroll your target element. This means that you have to have your mouse cursor directly over an element in order to scroll it. So, at certain resolutions where the dialog is filled with a nested scrollable element, you would never be able to scroll the parent, and become stuck.
The goal of Overlayable's scroll event listener seems to be to prevent the background/body from scrolling while an overlay is active. This tweak seeks to maintain this intention, but while allowing the active elements within the overlay to still scroll correctly.
How Has This Been Tested?
Visually, by recreating conditions for the issue to arise.
Markup:
Types of changes
Checklist:
master
for bug fixes and documentation updates,dev
for new features and backwards compatible changes andnext
for non-backwards compatible changes).