Skip to content

Commit

Permalink
[Popover] Warn when the height of the Popover is too tall
Browse files Browse the repository at this point in the history
  • Loading branch information
amilagm authored and oliviertassinari committed Oct 25, 2017
1 parent 86a9675 commit a44ac38
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit a44ac38

Please sign in to comment.