Skip to content

Conversation

@jschuler
Copy link
Collaborator

Add popover positioning support

Closes: #487

@coveralls
Copy link

coveralls commented Dec 11, 2018

Pull Request Test Coverage Report for Build 3672

  • 24 of 59 (40.68%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.7%) to 81.48%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/patternfly-4/react-core/src/components/Popover/PopoverBody.js 1 2 50.0%
packages/patternfly-4/react-core/src/components/Popover/PopoverCloseButton.js 1 2 50.0%
packages/patternfly-4/react-core/src/components/Popover/PopoverContent.js 1 2 50.0%
packages/patternfly-4/react-core/src/components/Popover/PopoverHeader.js 1 2 50.0%
packages/patternfly-4/react-core/src/components/Popover/Popover.js 19 50 38.0%
Totals Coverage Status
Change from base Build 3669: -0.7%
Covered Lines: 4319
Relevant Lines: 5003

💛 - Coveralls

@patternfly-build
Copy link
Collaborator

PatternFly-React preview: https://1032-pr-patternfly-react-patternfly.surge.sh

@jschuler
Copy link
Collaborator Author

@christiemolloy I have some questions regarding the popover.

  • Is there supposed to be specific animation tied into showing/hiding the popover?
  • What should the behavior be if a popover would overflow in the current view? For example, if the popover is opening to the top, but there is not enough space to show the whole popover, should it be flipped to the bottom? This is the functionality I currently have implemented (but can be turned off).

@jgiardino Should the user be able to tab into the popover? What should the flow here be?

boaz0
boaz0 previously approved these changes Dec 11, 2018
@jgiardino
Copy link
Contributor

@jgiardino Should the user be able to tab into the popover? What should the flow here be?

For the popover, I would trap focus like we do for modal (#1011) and use the same keyboard interaction that we use for the modal. The expected keyboard interaction for modal is described in issue #561

Let me know if you have questions about this. The documentation regarding where to place initial focus in the modal/popover is quite long.

@jschuler
Copy link
Collaborator Author

Thanks @jgiardino , I'll focus trap similar to the modal

@christiemolloy
Copy link
Member

christiemolloy commented Dec 11, 2018

@jschuler to your second point about overflow of the popover in your current view, I think thats definitely the right approach to flip the positioning, and that would be the case for all 4 positions.

And to your first point there should be an animation tied to the popover. @mcarrano can you clarify this behavior?

Also what does the "Keep in View" check do?

@mcarrano
Copy link
Member

I think this looks great @jschuler . I like the approach to flip the orientation to keep the popover in view. As to the question about animation, I like what you've done. We really never settled on a standard for animating objects that open and close. Is there a good way to package and reuse this so we don't have inconsistent effects for various components that require animation?

Copy link
Contributor

@tlabaj tlabaj 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 Initially we hd said we would use popper. Curios why we are using tippy?

@jschuler
Copy link
Collaborator Author

@tlabaj tippy is powered by popper, but also does a lot of things we'd still have to do if we used popper straight up

dlabaj
dlabaj previously approved these changes Dec 12, 2018
@jschuler jschuler dismissed stale reviews from dlabaj and boaz0 via 13a6546 December 12, 2018 22:16
lazy
trigger={handleEvents ? 'click' : 'manual'}
isVisible={isVisible}
hideOnClick={shouldHideOnClick()}
Copy link
Contributor

Choose a reason for hiding this comment

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

do you really want to call the function here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it basically maps the prop hideOnOutsideClick with values of true or false to true and 'toggle'

<Button onClick={onClose} variant="plain" aria-label="Action">
const PopoverCloseButton = ({ onClose, ...rest }) => (
<div className={css(styles.popoverClose)} {...rest}>
<Button onClick={onClose} variant="plain" aria-label="Close">
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add the aria-label as prop that can be applied to a button for localization purposes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I'll do that

@ibolton336 ibolton336 self-requested a review December 19, 2018 14:31
tlabaj
tlabaj previously approved these changes Dec 19, 2018
ibolton336
ibolton336 previously approved these changes Dec 19, 2018
Copy link
Member

@ibolton336 ibolton336 left a comment

Choose a reason for hiding this comment

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

👍

@tlabaj tlabaj merged commit 13430ef into patternfly:master Dec 19, 2018
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.

10 participants