From a44ac382f5c5a677663149218c622bcdccf4532d Mon Sep 17 00:00:00 2001 From: amilagm Date: Wed, 25 Oct 2017 11:57:19 +1100 Subject: [PATCH] [Popover] Warn when the height of the Popover is too tall --- src/Popover/Popover.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Popover/Popover.js b/src/Popover/Popover.js index 2f5d6af2781603..642bd5c017f8bf 100644 --- a/src/Popover/Popover.js +++ b/src/Popover/Popover.js @@ -261,6 +261,15 @@ class Popover extends React.Component { 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;