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

[Popover] Warn when the height of the Popover is too tall #8839

Merged
merged 1 commit into from Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Popover/Popover.js
Expand Up @@ -261,6 +261,15 @@ class Popover extends React.Component<ProvidedProps & Props> {
transformOrigin.vertical += diff;
}

warning(
elemRect.height < heightThreshold || !elemRect.height || !heightThreshold,
[
'Material-UI: the Popover component is too tall.',
`Some part of it can not be seen on the screen (${elemRect.height - heightThreshold}px).`,
'Please consider adding a `max-height` to improve the user-experience.',
].join('\n'),
);

// Check if the horizontal axis needs shifting
if (left < marginThreshold) {
const diff = left - marginThreshold;
Expand Down