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

[Dialog] Remove scroll prop #14717

Closed
wants to merge 2 commits into from
Closed

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Mar 2, 2019

Had a hard time finding a proper way to test this behavior on a mounted component. Looks like this implements the same feature while getting rid of some internal gotchas (onBackdropClick not actually being fired from the Backdrop, opinionated role="document" that looked like it was only attached to appease the linter etc.

@joshwooding did most of the work to fix #13648. Could you take a look if this is still good?

If this is accepted I'll improve the tests later to use mount. Don't think the tests give use much confidence here anyway since it relies heavily on event bubbling/capturing. Would be better to have a real e2e test here.

@eps1lon eps1lon added the component: dialog This is the name of the generic UI component, not the React module! label Mar 2, 2019
@eps1lon eps1lon requested a review from joshwooding March 2, 2019 21:26
@@ -7,7 +7,6 @@ import Fade from '../Fade';
export const styles = {
/* Styles applied to the root element. */
root: {
zIndex: -1,
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm probably overly naive here. But wouldn't you want the backdrop to block the main document? Therefore putting it behind sounds wrong. Is this required to make it work with other components?

Copy link
Member

Choose a reason for hiding this comment

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

Try the scroll body demo. You should see a problem with the scroll.

Copy link
Member Author

Choose a reason for hiding this comment

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

https://deploy-preview-14717--material-ui.netlify.com/demos/dialogs/#scrolling-long-content ? I don't "see a problem". Could explain what's expected, what actually happens and why this should happen?

Copy link
Member

Choose a reason for hiding this comment

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

You can't scroll when hovering the backdrop.

Copy link
Member Author

Choose a reason for hiding this comment

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

mui-scroll

Copy link
Member Author

Choose a reason for hiding this comment

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

jQuery ui doesn't have a backdrop: https://codesandbox.io/s/7wx2k0mmrq. The rest of the document isn't inert i.e. if I scroll both body and modal scroll. The argument doesn't apply.

Copy link
Member Author

Choose a reason for hiding this comment

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

@oliviertassinari I'm not aiming for some gotcha here. This is me legit asking where you've seen scrollbars that are detached from the content they scroll and if you have some resources that describe this UX pattern.

Sorry, I have updated the comment replacing "ask for" with "need".

If they justify that need sure. It doesn't look that way though looking through the linked issues/prs.

Copy link
Member

@oliviertassinari oliviertassinari Mar 5, 2019

Choose a reason for hiding this comment

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

Please, let's move to a different topic, we should keep the scroll body. I don't want to get into the fundamental why, I doubt there is any non-opinionated A + B = C type of logical discussion we can get on the subject. I would rather save time by benchmarking what the others are doing. It's well accepted in literature and real world applications. There were smarter people than me that came to this conclusion

Copy link
Member Author

Choose a reason for hiding this comment

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

+100,000 views on stackoverflow.com/questions/10476632/how-to-scroll-the-page-when-a-modal-dialog-is-longer-than-the-screen

Accepted answer implements scroll=paper

Completely covering the background window also hides background movement that occurs on some mobile devices when scrolling content inside the dialog.

describes scroll=paper doesn't implement it though.

real world applications

Trello does it, accepted.

google products don't as far as I can tell.

Backdrop click bug is still an issue though

Copy link
Member

@oliviertassinari oliviertassinari Mar 5, 2019

Choose a reason for hiding this comment

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

google products don't as far as I can tell.

Yes. I know that Gmail doesn't do it & Keep doesn't do it. I haven't look deeper.

Backdrop click bug is still an issue though

Yeah, it was the cost of supporting this feature. @joshwooding & I couldn't find a better solution 😢. We have copied Bootstrap strategy.

@mui-pr-bot
Copy link

Details of bundle changes.

Comparing: ecc2c85...6902c6f

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core -0.01% -0.01% 371,758 371,722 91,928 91,916
@material-ui/core/Paper 0.00% 0.00% 76,930 76,930 19,372 19,372
@material-ui/core/Paper.esm 0.00% 0.00% 71,601 71,601 18,779 18,779
@material-ui/core/Popper 0.00% 0.00% 30,462 30,462 10,582 10,582
@material-ui/core/styles/createMuiTheme 0.00% 0.00% 17,286 17,286 5,717 5,717
@material-ui/core/useMediaQuery 0.00% 0.00% 2,486 2,486 1,048 1,048
@material-ui/lab 0.00% 0.00% 184,505 184,505 50,732 50,732
@material-ui/styles 0.00% 0.00% 57,733 57,733 16,236 16,236
@material-ui/system 0.00% 0.00% 17,062 17,062 4,487 4,487
Button 0.00% 0.00% 99,633 99,633 26,634 26,634
Modal -0.01% -0.03% 98,871 98,861 26,227 26,219
colorManipulator 0.00% 0.00% 3,232 3,232 1,296 1,296
docs.landing 0.00% 0.00% 52,369 52,369 11,488 11,488
docs.main -0.00% -0.00% 678,998 678,988 206,245 206,239
packages/material-ui/build/umd/material-ui.production.min.js -0.01% -0.01% 322,414 322,378 85,099 85,087

Generated by 🚫 dangerJS against 6902c6f

@eps1lon eps1lon changed the title [Dialog] Simply logic [Dialog] Simplify logic Mar 2, 2019
@eps1lon eps1lon force-pushed the refactor/Dialog/backdrop branch from 6902c6f to 5f4d8a4 Compare March 5, 2019 10:51
@eps1lon eps1lon changed the title [Dialog] Simplify logic [Dialog] Remove scroll prop Mar 5, 2019
@eps1lon eps1lon closed this Mar 5, 2019
@eps1lon eps1lon deleted the refactor/Dialog/backdrop branch March 5, 2019 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dialog] onBackdropClick event fires when draggable item released on it
4 participants