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

fix: mouse events cannot be triggered on a disabled button #551

Closed
wants to merge 2 commits into from

Conversation

cheton
Copy link
Member

@cheton cheton commented Mar 30, 2022

Description

This PR changes onMouseEnter, onMouseLeave, and onMouseMove to onPointerEnter, onPointerLeave, and onPointerMove for the PopoverTrigger component. With this change, the popover trigger that wraps a disabled button will be able to receive pointer events.

Demo: https://trendmicro-frontend.github.io/tonic-ui-demo/react/pr-551/components/popover

<Popover trigger="hover">
  <PopoverTrigger>
    <Button disabled>Disabled Button</Button>
  </PopoverTrigger>
  <PopoverContent>
    Popover
  </PopoverContent>
</Popover>

Further Actions

Examine whether we will change onMouseXXX to onPointerXXX for below components:

./popover/PopoverContent.js:  onMouseEnter,
./popover/PopoverContent.js:  onMouseLeave,
./popover/PopoverContent.js:      onMouseEnter: wrapEvent(onMouseEnter, () => {
./popover/PopoverContent.js:      onMouseLeave: wrapEvent(onMouseLeave, () => {
./scrollbar/Scrollbar.js:      onMouseEnter: handleScrollViewMouseEnter,
./scrollbar/Scrollbar.js:      onMouseLeave: handleScrollViewMouseLeave,
./scrollbar/Scrollbar.js:      onMouseDown: handleHorizontalTrackMouseDown,
./scrollbar/Scrollbar.js:      onMouseEnter: handleTrackMouseEnter,
./scrollbar/Scrollbar.js:      onMouseLeave: handleTrackMouseLeave,
./scrollbar/Scrollbar.js:      onMouseDown: handleHorizontalThumbMouseDown,
./scrollbar/Scrollbar.js:      onMouseDown: handleVerticalTrackMouseDown,
./scrollbar/Scrollbar.js:      onMouseEnter: handleTrackMouseEnter,
./scrollbar/Scrollbar.js:      onMouseLeave: handleTrackMouseLeave,
./scrollbar/Scrollbar.js:      onMouseDown: handleVerticalThumbMouseDown,
./tooltip/Tooltip.js:      onMouseEnter: handleOpen,
./tooltip/Tooltip.js:      onMouseLeave: handleClose,
./toast/ToastController.js:  const onMouseEnter = () => setDelay(null);
./toast/ToastController.js:  const onMouseLeave = () => setDelay(duration);
./toast/ToastController.js:      onMouseEnter={onMouseEnter}
./toast/ToastController.js:      onMouseLeave={onMouseLeave}

Reference

@trendmicro-frontend-bot
Copy link
Contributor

@codecov
Copy link

codecov bot commented Mar 30, 2022

Codecov Report

Merging #551 (6d5f810) into master (01d2493) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master     #551   +/-   ##
=======================================
  Coverage   28.33%   28.33%           
=======================================
  Files         304      304           
  Lines        4045     4045           
=======================================
  Hits         1146     1146           
  Misses       2899     2899           
Flag Coverage Δ
react 22.50% <0.00%> (ø)
react-hooks 94.56% <ø> (ø)
styled-system 68.95% <ø> (ø)
theme 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/react/src/popover/PopoverTrigger.js 4.65% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01d2493...6d5f810. Read the comment docs.

@cheton cheton force-pushed the master branch 2 times, most recently from 91cc322 to b5068f7 Compare March 31, 2022 10:32
@cheton cheton marked this pull request as draft April 8, 2022 14:35
@cheton cheton closed this Apr 10, 2022
@cheton cheton deleted the tonic-ui-550 branch April 10, 2022 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] The popover would not disappear when wrapping disabled button
2 participants