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

Update calculatePopoverPosition to seek the position with the largest amount of visible surface area of the popover. #550

Merged
merged 6 commits into from
Mar 21, 2018

Conversation

cjcenizal
Copy link
Contributor

@cjcenizal cjcenizal commented Mar 21, 2018

Fixes #545

The original logic for this method found the position with the least amount of overflow in a single direction, but for the optimal UX it needs to consider how much total surface area of the popover is being clipped, and choose the position where as much of the popover is visible as possible.

popover_position

@cjcenizal cjcenizal requested review from snide, nreese and arkwright March 21, 2018 00:54
@cjcenizal cjcenizal force-pushed the calculate-popover-position branch from 1582230 to 48e7f74 Compare March 21, 2018 00:56
… amount of visible surface area of the popover.
@cjcenizal cjcenizal force-pushed the calculate-popover-position branch 2 times, most recently from 90a6de5 to 263dd95 Compare March 21, 2018 01:01
- Fix mistakes with calculating height and width differences.
- Remove calculatePopoverStyles.
Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Looks good. Can you add responsive={false} onto your FlexGroup to fix this example.

image

/**
* Determine the best position for a popup that avoids clipping by the window view port.
* Determine the best position for a popover that avoids clipping by the window view port.
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this comment get detached from the function it describes.

@cjcenizal
Copy link
Contributor Author

@nreese @snide Done

@cjcenizal cjcenizal force-pushed the calculate-popover-position branch from c1cc5d5 to b72356f Compare March 21, 2018 03:34
Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

lgtm

@cjcenizal cjcenizal merged commit 7351dd1 into elastic:master Mar 21, 2018
@cjcenizal cjcenizal deleted the calculate-popover-position branch March 21, 2018 13:52
@arkwright
Copy link
Contributor

Woo! Thanks @cjcenizal! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants