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

SVG Icons: Clicking on path prevents click #4662

Closed
melloware opened this issue Jul 17, 2023 · 0 comments · Fixed by #4663
Closed

SVG Icons: Clicking on path prevents click #4662

melloware opened this issue Jul 17, 2023 · 0 comments · Fixed by #4663
Assignees
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@melloware
Copy link
Member

melloware commented Jul 17, 2023

Describe the bug

Clicking on a SVG version of the icon doesn't always trigger a click event if you click on any painted path of the SVG.

Workaround:

svg.p-icon {
  pointer-events: auto;
}

svg.p-icon g {
  pointer-events: none;
}

Reproducer

https://stackblitz.com/edit/react-gu3eb7

PrimeReact version

9.6.0

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Click on the sort icon in the header.
  2. You might have to move your mouse pointer directly over a painted parted of the SVG and keep clicking you will see the click events are "swallowed".

Expected behavior

Clicking on the SVG icon should pass the click event through to the element below it.

See: https://stackoverflow.com/questions/22483643/svg-still-receives-clicks-even-if-pointer-events-visible-painted/

See: https://stackoverflow.com/questions/28282811/how-can-i-pass-only-clicks-through-a-svg-with-pointer-events

@melloware melloware added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 17, 2023
@melloware melloware self-assigned this Jul 17, 2023
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 17, 2023
@melloware melloware added this to the 9.6.1 milestone Jul 17, 2023
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 17, 2023
melloware added a commit to melloware/primereact that referenced this issue Jul 17, 2023
@melloware melloware added Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 17, 2023
melloware added a commit to melloware/primereact that referenced this issue Jul 18, 2023
melloware added a commit to melloware/primereact that referenced this issue Jul 18, 2023
@melloware melloware modified the milestones: 10.0.0, 9.7.0 Aug 21, 2023
@melloware melloware modified the milestones: 9.7.0, 10.0.0 Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant