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

fix(list): fix mobile device dragging with nested lists #9573

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions packages/calcite-components/src/components/list/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
connectSortableComponent,
disconnectSortableComponent,
SortableComponent,
dragActive,
} from "../../utils/sortableComponent";
import { SLOTS as STACK_SLOTS } from "../stack/resources";
import {
Expand Down Expand Up @@ -400,10 +399,6 @@ export class List
//--------------------------------------------------------------------------

connectedCallback(): void {
if (dragActive(this)) {
return;
}

connectLocalized(this);
connectMessages(this);
this.connectObserver();
Expand All @@ -427,10 +422,6 @@ export class List
}

disconnectedCallback(): void {
if (dragActive(this)) {
return;
}

this.disconnectObserver();
disconnectSortableComponent(this);
disconnectInteractive(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
connectSortableComponent,
disconnectSortableComponent,
SortableComponent,
dragActive,
} from "../../utils/sortableComponent";
import { focusElement } from "../../utils/dom";
import { CSS } from "./resources";
Expand Down Expand Up @@ -102,20 +101,12 @@ export class SortableList implements InteractiveComponent, SortableComponent {
// --------------------------------------------------------------------------

connectedCallback(): void {
if (dragActive(this)) {
return;
}

this.setUpSorting();
this.beginObserving();
connectInteractive(this);
}

disconnectedCallback(): void {
if (dragActive(this)) {
return;
}

disconnectInteractive(this);
disconnectSortableComponent(this);
this.endObserving();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import {
connectSortableComponent,
disconnectSortableComponent,
SortableComponent,
dragActive,
} from "../../utils/sortableComponent";
import { focusElement } from "../../utils/dom";
import { ValueListMessages } from "./assets/value-list/t9n";
Expand Down Expand Up @@ -240,10 +239,6 @@ export class ValueList<
// --------------------------------------------------------------------------

connectedCallback(): void {
if (dragActive(this)) {
return;
}

connectInteractive(this);
connectLocalized(this);
connectMessages(this);
Expand All @@ -267,10 +262,6 @@ export class ValueList<
}

disconnectedCallback(): void {
if (dragActive(this)) {
return;
}

disconnectInteractive(this);
disconnectSortableComponent(this);
disconnectLocalized(this);
Expand Down
8 changes: 8 additions & 0 deletions packages/calcite-components/src/utils/sortableComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ export interface SortableComponentItem {
* @param {SortableComponent} component - The sortable component.
*/
export function connectSortableComponent(component: SortableComponent): void {
if (dragActive(component)) {
return;
}

disconnectSortableComponent(component);
sortableComponentSet.add(component);

Expand Down Expand Up @@ -152,6 +156,10 @@ export function connectSortableComponent(component: SortableComponent): void {
* @param {SortableComponent} component - The sortable component.
*/
export function disconnectSortableComponent(component: SortableComponent): void {
if (dragActive(component)) {
return;
}

sortableComponentSet.delete(component);

component.sortable?.destroy();
Expand Down
Loading