mokhosh / filament-kanban

Add kanban boards to your Filament pages
https://filamentphp.com/plugins/mokhosh-kanban
MIT License
228 stars 32 forks source link

[Bug]: Mobile click not working #40

Closed albertobenavides closed 2 months ago

albertobenavides commented 2 months ago

What happened?

On mobile (Android, not tested on iPhone), the draggable attribute prevent records to be clicked, also preventing the edit modal to appear.

How to reproduce the bug

Click records in Kanban while in mobile.

Package Version

Lastest

PHP Version

8.2

Laravel Version

11

Which operating systems does with happen with?

No response

Which browsers does with happen with?

Chrome

Notes

No response

mokhosh commented 2 months ago

Yes, sortablejs is preventing the click event to go through on mobile for some reason.

I'm not using this on mobile since kanban boards don't make much sense on mobile to begin with, but if you need to have it on mobile there is an easy fix:

  1. Publish the views. Keep the script view. If you want to change this for all your kanban boards keep the record view as well, otherwise customize the record view per kanban board.

  2. Choose a section of your record as your drag "handle":

    <div class="handle">
    <span>{{ $record->nickname }}</span>
    </div>
  3. Use this handle in your script:

    statuses.forEach(status => Sortable.create(document.querySelector(`[data-status-id='${status}']`), {
    handle: '.handle',
    // ...
mokhosh commented 2 months ago

Here are some related issues and PRs for reference. You can also find some alternative solutions if you dig into them, like setting a delay.

https://github.com/SortableJS/Sortable/issues/2312

https://github.com/SortableJS/Sortable/pull/441

https://github.com/SortableJS/Sortable/pull/411

https://github.com/SortableJS/Sortable/issues/2136

albertobenavides commented 2 months ago

Hello, I have found the solution by using SortableJS, Thank you very much. Adding this in resources\views\vendor\filament-kanban\kanban-scripts.blade.php worked for me:

delayOnTouchOnly: true,
delay : 100,