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

feat(Popover) add option to trigger popover on hover #9283

Merged
merged 4 commits into from
Aug 3, 2023

Conversation

Dominik-Petrik
Copy link
Contributor

What: Closes #7072

const onContentMouseDown = () => {
if (focusTrapActive) {
setFocusTrapActive(false);
}
};

const onMouseEnter = (event: any) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need some help with typing the event parameter, I tried couple things but could not come up with what type and type conversions to use. It'd be great if anyone could help.

@patternfly-build
Copy link
Contributor

patternfly-build commented Jun 19, 2023

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

This is looking good so far! Had some comments below, additionally some other comments below for @andrew-ronaldson

  • if we're offering a Popover to be triggered on hover, we should also support it being triggered on focus for users that navigate with keyboard. Otherwise they won't be able to view the Popover content (assuming this is a choice between hover or click).
  • Is it expected that a hover Popover won't contain any content that requires/offers interaction? I.e. buttons/links, scrollable containers that require scrolling, etc. If there is interactive content within this type of Popover, it could lead to a11y issues. Tying into the above bullet, if I focus a trigger and that causes a Popover to open, focus would have to be placed inside the Popover when I press Tab if there's interactive content; that might require (us or consumers) to manage focus if a Popover is appended to the end of the document.

@@ -279,6 +282,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
const showTimerRef = React.useRef(null);
const hideTimerRef = React.useRef(null);
const popoverRef = React.useRef(null);
const hideShowTime = variant === 'hover' ? animationDuration : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This will probably have to be updated once #9339 goes in, cc @wise-king-sullyman

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah it will if it's needed, though I'm not sure it will be? In #9339 I already have the entryDelay and exitDelay props enabling consumer side customization of those timeout values.

packages/react-core/src/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/react-core/src/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/react-core/src/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/react-core/src/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Depending on the order things are merged, may need another update if 9339 goes in first

@thatblindgeye
Copy link
Contributor

Opened #9441 to resolve the tests that were skipped in this PR

@tlabaj tlabaj requested a review from mmenestr August 2, 2023 14:47
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.

lgtm

@mmenestr
Copy link
Collaborator

mmenestr commented Aug 3, 2023

Looks good! Just wonder about how short the delay is between hover and popover showing up - as long as that delay time is customizable, I approve!

@tlabaj tlabaj merged commit 5d1c92e into patternfly:main Aug 3, 2023
10 checks passed
nicolethoen pushed a commit to Kells512/patternfly-react that referenced this pull request Sep 1, 2023
* feat(Popover) add option to trigger popover on hover

* trigger popover on focus, minor changes

* Removed unnecessary hideShowTime var

* Skipped failing tests

---------

Co-authored-by: Eric Olkowski <[email protected]>
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.

Popover: add option to trigger a popover on hover
6 participants