Enable auto-scroll for drag and drop (#22725)

This commit is contained in:
Paul Bottein 2024-11-07 17:33:18 +01:00 committed by GitHub
parent a56e22790d
commit 4c898a2a5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -135,6 +135,10 @@ export class HaSortable extends LitElement {
const Sortable = (await import("../resources/sortable")).default; const Sortable = (await import("../resources/sortable")).default;
const options: SortableInstance.Options = { const options: SortableInstance.Options = {
scroll: true,
// Force the autoscroll fallback because it works better than the native one
forceAutoScrollFallback: true,
scrollSpeed: 20,
animation: 150, animation: 150,
...this.options, ...this.options,
onChoose: this._handleChoose, onChoose: this._handleChoose,

View File

@ -1,10 +1,11 @@
import type Sortable from "sortablejs"; import type Sortable from "sortablejs";
import SortableCore, { import SortableCore, {
OnSpill,
AutoScroll, AutoScroll,
OnSpill,
} from "sortablejs/modular/sortable.core.esm"; } from "sortablejs/modular/sortable.core.esm";
SortableCore.mount(OnSpill, new AutoScroll()); SortableCore.mount(OnSpill);
SortableCore.mount(new AutoScroll());
export default SortableCore as typeof Sortable; export default SortableCore as typeof Sortable;