Skip to content

Commit c7ad287

Browse files
authored
TextArea: it should be possible to scroll focused input (T1290309)
1 parent fcfa9a4 commit c7ad287

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

packages/devextreme/js/__internal/ui/date_box/m_date_box.mask.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ class DateBoxMask extends DateBoxBase {
451451
}
452452
}
453453

454+
_hasMouseWheelHandler(): boolean {
455+
return true;
456+
}
457+
454458
_onMouseWheel(e): void {
455459
if (this._useMaskBehavior()) {
456460
this._partIncrease(e.delta > 0 ? FORWARD : BACKWARD, e);

packages/devextreme/js/__internal/ui/number_box/m_number_box.base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ class NumberBoxBase<
182182
this._keyPressed = true;
183183
}
184184

185+
_hasMouseWheelHandler(): boolean {
186+
return true;
187+
}
188+
185189
_onMouseWheel(dxEvent): void {
186190
dxEvent.delta > 0 ? this._spinValueChange(1, dxEvent) : this._spinValueChange(-1, dxEvent);
187191
}

packages/devextreme/js/__internal/ui/text_box/m_text_editor.mask.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
import messageLocalization from '@js/common/core/localization/message';
77
import type { dxElementWrapper } from '@js/core/renderer';
88
import $ from '@js/core/renderer';
9-
import { noop } from '@js/core/utils/common';
109
import type { DeferredObj } from '@js/core/utils/deferred';
1110
import { extend } from '@js/core/utils/extend';
1211
import { each } from '@js/core/utils/iterator';
@@ -144,9 +143,7 @@ class TextEditorMask<
144143
}
145144

146145
_attachMouseWheelEventHandlers(): void {
147-
const hasMouseWheelHandler = this._onMouseWheel !== noop;
148-
149-
if (!hasMouseWheelHandler) {
146+
if (!this._hasMouseWheelHandler()) {
150147
return;
151148
}
152149

@@ -169,6 +166,10 @@ class TextEditorMask<
169166
});
170167
}
171168

169+
_hasMouseWheelHandler(): boolean {
170+
return false;
171+
}
172+
172173
// eslint-disable-next-line @typescript-eslint/no-unused-vars
173174
_onMouseWheel(e?): void {}
174175

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/textArea.tests.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ QUnit.module('rendering', () => {
8989
pointerMock($input).start().down().move(0, 40).scroll(0, 40).up();
9090
$(document).off('.dxtestns');
9191
});
92+
93+
QUnit.test('Wheel event inside focused TextArea should not trigger _onMouseWheel call (T1290309)', function(assert) {
94+
const textArea = $('#textarea').dxTextArea({}).dxTextArea('instance');
95+
const onMouseWheelSpy = sinon.spy(textArea, '_onMouseWheel');
96+
const $input = textArea._input();
97+
98+
textArea.focus();
99+
pointerMock($input).wheel(-10);
100+
101+
assert.strictEqual(onMouseWheelSpy.callCount, 0, '_onMouseWheel was not called');
102+
});
92103
});
93104

94105
QUnit.module('options changing', () => {

0 commit comments

Comments
 (0)