diff --git a/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts b/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts index 718913429957..2e4643cb3adf 100644 --- a/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts +++ b/packages/devextreme/js/__internal/scheduler/m_appointment_drag_behavior.ts @@ -130,7 +130,7 @@ export default class AppointmentDragBehavior { // NOTE: event.cancel may be promise or different type, so we need strict check here. if (e.cancel === true) { - this.removeDroppableClasses(); + options.onDragCancel(e); } if (e.cancel !== true && isSchedulerComponent(e.toComponent)) { diff --git a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts index 67268ae4b1db..a35b016cb6d2 100644 --- a/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts +++ b/packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts @@ -51,6 +51,7 @@ import { import WidgetObserver from '../base/m_widget_observer'; import AppointmentDragBehavior from '../m_appointment_drag_behavior'; import { + APPOINTMENT_DRAG_SOURCE_CLASS, DATE_TABLE_CLASS, DATE_TABLE_ROW_CLASS, FIXED_CONTAINER_CLASS, @@ -3386,6 +3387,15 @@ const createDragBehaviorConfig = ( removeDroppableCellClass(); }; + const onDragCancel = (e) => { + if (!isDefaultDraggingMode) { + enableDefaultDragging(); + } + + removeDroppableCellClass(); + e.itemElement?.removeClass?.(APPOINTMENT_DRAG_SOURCE_CLASS); + }; + const cursorOffset = options.isSetCursorOffset ? () => { const $dragElement = $(state.dragElement); @@ -3402,6 +3412,7 @@ const createDragBehaviorConfig = ( onDragStart, onDragMove, onDragEnd, + onDragCancel, cursorOffset, filter: options.filter, }; diff --git a/packages/devextreme/testing/testcafe/tests/scheduler/dragAndDrop/T1263508.ts b/packages/devextreme/testing/testcafe/tests/scheduler/dragAndDrop/T1263508.ts new file mode 100644 index 000000000000..7d099b7548c4 --- /dev/null +++ b/packages/devextreme/testing/testcafe/tests/scheduler/dragAndDrop/T1263508.ts @@ -0,0 +1,103 @@ +import { ClientFunction, Selector } from 'testcafe'; +import Scheduler from '../../../model/scheduler'; +import { MouseAction, MouseUpEvents } from '../../../helpers/mouseUpEvents'; +import { createWidget } from '../../../helpers/createWidget'; +import url from '../../../helpers/getPageUrl'; + +fixture.disablePageReloads`Scheduler Drag-and-Drop Fix` + .page(url(__dirname, '../../container.html')); + +const DRAGGABLE_ITEM_CLASS = 'dx-card'; +const draggingGroupName = 'appointmentsGroup'; + +const initList = ClientFunction(() => { + $('