Skip to content

Commit

Permalink
ScrollView - The scrolling operation is interrupted on touch devices …
Browse files Browse the repository at this point in the history
…(T886654) (#12917) (#12926)
  • Loading branch information
EugeniyKiyashko authored May 6, 2020
1 parent 36a56c8 commit a6d1532
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/ui/overlay/ui.overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ var Overlay = Widget.inherit({
const originalEvent = e.originalEvent.originalEvent;
e._cancelPreventDefault = true;

if(originalEvent && originalEvent.type !== 'mousemove') {
if(originalEvent && originalEvent.type !== 'mousemove' && e.cancelable !== false) {
e.preventDefault();
}
});
Expand Down
43 changes: 43 additions & 0 deletions testing/tests/DevExpress.ui.widgets/overlay.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3528,6 +3528,49 @@ testModule('scrollable interaction', {
.off('.TEST');
});

// T886654
test('Scroll event should not prevented on overlay that avoid the [Intervation] error when event is not cancelable', function(assert) {
assert.expect(1);

const $overlay = $($('#overlay').dxOverlay());
const $scrollable = $('<div>');

$overlay.dxOverlay('instance').option('visible', true);
const $content = $($overlay.dxOverlay('$content')).append($scrollable);

$scrollable.dxScrollable({
useNative: true,
bounceEnabled: false,
direction: 'vertical',
inertiaEnabled: false
});

const $overlayWrapper = $content.closest(toSelector(OVERLAY_WRAPPER_CLASS));

$($overlayWrapper).on('dxdrag', {
getDirection: () => 'both',
validate: () => true
}, (e) => {
assert.strictEqual(e.isDefaultPrevented(), false, 'not cancelable event should not be prevented');
});

$($overlayWrapper.parent()).on('dxdrag', {
getDirection: function() { return 'both'; },
validate: function() { return true; }
}, function() {
assert.ok(false, 'event should not be fired');
});

const event = $.Event('dxdrag', {
cancelable: false,
originalEvent: $.Event('dxpointermove', {
originalEvent: $.Event('touchmove')
})
});

$($overlayWrapper).trigger(event);
});

test('scroll event does not prevent gestures', function(assert) {
const $gestureCover = $('.dx-gesture-cover');
const originalPointerEvents = $gestureCover.css('pointerEvents');
Expand Down

0 comments on commit a6d1532

Please sign in to comment.