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
[Issue] The popover would not disappear when wrapping disabled button #550
Comments
@light049 Pointer Events should have been supported by modern browsers and React v16.4 |
@light049 This issue will be resolved in PR #551 You can use the follwoing code as a temporary workaround while waiting for a hotfix release. <Popover trigger="hover">
<PopoverTrigger>
{({ getPopoverTriggerProps }) => {
const popoverTriggerProps = getPopoverTriggerProps();
popoverTriggerProps.onPointerEnter = popoverTriggerProps.onMouseEnter;
popoverTriggerProps.onPointerLeave = popoverTriggerProps.onMouseLeave;
popoverTriggerProps.onPointerMove = popoverTriggerProps.onMouseMove;
return (
<Button disabled {...popoverTriggerProps}>Disabled Button</Button>
);
}}
</PopoverTrigger>
<PopoverContent>
Popover
</PopoverContent>
</Popover> |
@cheton Thanks for your example.
|
You have to wrap your component using const Btn = forwardRef((
{
disabled,
...restProps
},
ref,
) => {
return (
<Button ref={ref} disabled {...restProps}>Disabled Button</Button>
);
}); |
FYI pointer events (in the nature of fixing this bug, not the support in general) don't work in Safari also so I wouldn't consider it a solution. It's a problem with React's delegation/synthetic system: https://twitter.com/atomiksdev/status/1510512851198242819 |
@atomiks @light049 This issue is related to facebook/react#11972 See https://github.com/chakra-ui/chakra-ui/blob/next/packages/tooltip/src/use-tooltip.ts /**
* This allows for catching mouseleave events when the tooltip
* trigger is disabled. There's currently a known issue in
* React regarding the onMouseLeave polyfill.
* @see https://github.com/facebook/react/issues/11972
*/
useEventListener("mouseleave", closeWithDelay, () => ref.current) The workaround is to listen to the native |
Fixed in #561 |
Descriptions
The popover would not disappear as expected when wrapping a disabled button.
Workaround
As a reference to get expected results
The text was updated successfully, but these errors were encountered: