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

Interactive elements are activated after dragging in <sl-carousel mouse-dragging> #2196

Closed
alexnozer opened this issue Oct 1, 2024 · 1 comment
Labels
bug Things that aren't working right in the library. good first issue This bug or task is a good first issue for new contributors. help wanted Ready for a contributor to tackle.

Comments

@alexnozer
Copy link

alexnozer commented Oct 1, 2024

Describe the bug

When using cards with interactive elements in the mouse-dragging carousel, these interactive elements are activated after the drag ends when the mouse key is released.

There is a fairly common pattern where the clickable area of a link is stretched using a pseudo element to make the entire card interactive. Heydon Pickering writes about this. With this approach, immediately after dragging the carousel to view the cards, the link will be clicked and a new page will load.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the CodePen demo
  2. Click on any carousel card and try to drag it
  3. Release the mouse button to finish dragging
  4. A hidden paragraph with the card ID is displayed below the carousel *

* In the demo, this happens thanks to fragments href="#card1" and the :target pseudo class. In the real case, it will activate the link and go to a new page.

Demo

There are CodePen demo with a minimal reproduction.

Screencast

screencast.mp4

Browser / OS

  • OS: Windows
  • Browser: Chrome 129, Firefox 131
@alexnozer alexnozer added the bug Things that aren't working right in the library. label Oct 1, 2024
@evayde
Copy link
Contributor

evayde commented Nov 4, 2024

We could suppress click events while dragging. I've created a PR for that, feel free to check it out.

@claviska claviska added help wanted Ready for a contributor to tackle. good first issue This bug or task is a good first issue for new contributors. labels Nov 4, 2024
claviska added a commit that referenced this issue Nov 5, 2024
carlos-verdes pushed a commit to majidalfuttaim/maf-ui that referenced this issue Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library. good first issue This bug or task is a good first issue for new contributors. help wanted Ready for a contributor to tackle.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants