-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Menu] maxHeight spec compliance #7378
Conversation
The motivation sounds good to me |
src/Menu/Menu.js
Outdated
@@ -159,7 +154,7 @@ class Menu extends Component<DefaultProps, Props, void> { | |||
<Popover | |||
anchorEl={anchorEl} | |||
getContentAnchorEl={this.getContentAnchorEl} | |||
className={classNames(classes.root, className)} | |||
className={className} | |||
open={open} | |||
enteredClassName={classes.entered} |
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.
Is that a dead key?
src/Menu/Menu.js
Outdated
maxHeight: 250, | ||
}, | ||
}); | ||
export const styleSheet = createStyleSheet('MuiMenu', {}); |
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.
I don't think that we need to keep it. I don't follow the motivation.
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.
If entered is a dead key, then we don't need it. I'll double check. Otherwise withStyles requires a non null styleSheet to allow nested overrides.
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.
I don't think that we need any CSS customization power on that component. Let me know :).
Should close #7368. |
As I started the requested change, I noticed an inconsistency and started increasing flow types, which I ended up strengthening flow coverage on several interrelated files. So the purpose is still the same, I just increased flow coverage with the additional changes. |
I have no idea how I decreased coverage, perhaps the indicator is a bit too sensitive. This is the complaint, and I'm not sure how to test (or if it is worth) testing the code concerned, so I'm inclined to merge unless there is an objection. |
After sleeping on it, it seemed to make sense to add back max height based on I see this does not solve #7368, but I think this is the right change. We should look at how to solve scrollbar not showing automatically as a separate bug. |
@@ -1,4 +1,5 @@ | |||
--require babel-register | |||
--require jsdom-global/register |
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.
What is this for, don't we already inject what's needed in https://github.com/callemall/material-ui/blob/v1-alpha/test/utils/dom.js?
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.
Could be for the HTMLElement thing? Won't that break server-side rendering?
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 is needed for reference to instanceof HTMLElement
usage in code, under mocha, HTMLElement
is undefined
.
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.
Should be good. Still, we gonna need SSR tests.
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.
We'll either need to, or instruct the user to shim for server side rendering. e.g. var HTMLElement = typeof HTMLElement === 'undefined' ? function(){} : HTMLElement;
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.
BTW - I think this should be left to userland to shim, it seems to be a common issue, and no need for us to shim for the user, just the same as we don't babel-polyfill for them either.
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.
Oh, extending the dom.js could be even better :).
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.
So we better control the global scope.
The current menu
maxHeight
is arbitrarily set to be250px
, and this is too prescriptive for general use.The spec states:
Therefore, it is up to userland to set this limitation unless someone wants to create a smart height listener/implementation.
As a note, I left an empty stylesheet as
withStyles
requires one and classes are passed down (and tested).This fixes a situation like this:
![](https://user-images.githubusercontent.com/136564/27974988-fe2fe656-6325-11e7-8e17-7438835525ab.png)