Skip to content

Commit

Permalink
ScrollView UI glitch temporarily highlights text on the page when the…
Browse files Browse the repository at this point in the history
… scrollbar is used (T1240632) (#27834)
  • Loading branch information
EugeniyKiyashko authored Jul 26, 2024
1 parent d4384ba commit fe7f74e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const Scrollbar = (Widget as any).inherit({
eventsEngine.on(this._$thumb, addNamespace(pointerEvents.down, SCROLLBAR), this.feedbackOn.bind(this));
},

feedbackOn() {
feedbackOn(e) {
e?.preventDefault();

this.$element().addClass(SCROLLABLE_SCROLLBAR_ACTIVE_CLASS);
activeScrollbar = this;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,22 @@ QUnit.test('scrollbar add active class when thumb is clicked', function(assert)
assert.equal($scrollbar.hasClass(SCROLLBAR_ACTIVE_CLASS), false, 'active class was not attached after mouse up');
});

QUnit.test('preventDefault should be called when the thumb is clicked cancels the default selection behavior', function(assert) {
const $scrollable = $('#scrollable').dxScrollable({
useNative: false,
showScrollbar: 'onHover',
scrollByThumb: true
});

const $thumb = $scrollable.find(`.${SCROLLABLE_SCROLL_CLASS}`);

const mouse = pointerMock($thumb).start();

mouse.down();

assert.strictEqual(mouse.lastEvent().isDefaultPrevented(), true, 'default action is prevented for dxpointerdown on a thumb click');
});

QUnit.test('scrollbar add active class when click on scrollbar area', function(assert) {
const SCROLLBAR_ACTIVE_CLASS = SCROLLABLE_SCROLLBAR_ACTIVE_CLASS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ QUnit.test('scroll by thumb', function(assert) {
mouse.move(0, distance);
location = getScrollOffset($scrollable);

assert.notOk(downEvent.isDefaultPrevented(), 'default is not prevented'); // T516691
assert.strictEqual(downEvent.isDefaultPrevented(), true, 'default should be prevented (T1240632)');
assert.equal(location.top, -distance / containerToContentRatio, 'scroll follows pointer');

mouse.move(0, distance);
Expand Down

0 comments on commit fe7f74e

Please sign in to comment.