Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Sortable click event does not work [Angular]

ciscofu pro asked 5 years ago


Expected behavior

Click handlers for buttons or anchors should work when they are in an element with mdbSortable applied to it.

Actual behavior

Clicking a button or anchor tag causes the parent component to be picked up (to be moved) and the click handler associated with the button or anchor tag is never called.

If the anchor tag has an href="" attribute, the page will be navigated (which is not good for an Angular application). However, if the anchor tag or button has a (click) handler, the handler will not be called.

The code example from "Sortable deck of cards" was used as a test, since it contains a button inside of a movable card. The button animation occurs when clicked, and the button does not initiate a drag, but the event associated with the button's (click) handler is still not called.

Resources (screenshots, code snippets etc.)

The following click handler is called when it is not in an element that is not sortable. When in a sortable element, the click handler will not be called:

<a mdbBtn (click)="detailToggle();" size="sm" color="info" rounded="true">{{ buttonText }}</a>

In my particular application, the parent element is a <li> with class "list-group-item". The anchor tag appears in its body.


Arkadiusz Idzikowski staff answered 5 years ago


Hello,

Thank you for reporting this problem, we will take a closer look at that. Unfortunately, if the click event is somehow blocked by the sortable directive, we won't be able to provide a workaround for now. The fix should be available in next version.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.5.0
  • Device: Computer
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No