Skip to content

Conversation

@anna-shakhova
Copy link
Contributor

No description provided.

@anna-shakhova anna-shakhova self-assigned this Nov 27, 2025
Copilot AI review requested due to automatic review settings November 27, 2025 13:07
@anna-shakhova anna-shakhova requested a review from a team as a code owner November 27, 2025 13:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue (T1314606) where unexpected page scrolling occurs when performing zoom operations on a chart using the mouse wheel. The fix introduces a timeout-based mechanism to prevent default scroll behavior for a brief window after zoom interactions, even when the zoom limit has been reached.

Key Changes:

  • Introduced a 500ms prevention window that continues to block page scrolling after zoom operations
  • Modified the event handling logic to track and extend the prevention window on subsequent wheel events
  • Added comprehensive test coverage for the timeout-based scroll prevention behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/devextreme/js/__internal/viz/chart_components/zoom_and_pan.ts Implements timer-based scroll prevention logic with new lastWheelTimer variable, setLastWheelTimer() function, and modified preventDefaults() signature; exports SCROLL_PREVENTION_TIMEOUT constant
packages/devextreme/testing/tests/DevExpress.viz.charts/zoomAndPan.tests.js Adds test case verifying that scroll prevention continues for 500ms after zoom limit is reached, testing timer reset on subsequent wheel events within the window
Comments suppressed due to low confidence (1)

packages/devextreme/js/__internal/viz/chart_components/zoom_and_pan.ts:573

  • The lastWheelTimer should be cleared in the cleanup() function to prevent potential memory leaks when the chart is disposed. Add clearTimeout(lastWheelTimer); at the beginning of the cleanup() function.
      cleanup() {
        renderer.root.off(EVENTS_NS);
        // @ts-expect-error
        zoomAndPan.actionData?.rect?.dispose();
        // @ts-expect-error
        zoomAndPan.actionData = null;
        renderer.root.css({ 'touch-action': '' });
      },

Copilot AI review requested due to automatic review settings November 28, 2025 12:50
@anna-shakhova anna-shakhova force-pushed the 25_2__T1314606_zoom_chart branch from 8f51c84 to e325bbe Compare November 28, 2025 12:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

packages/devextreme/js/__internal/viz/chart_components/zoom_and_pan.ts:573

  • The lastWheelTimer should be cleared in the cleanup() function to prevent potential memory leaks. When the zoom and pan functionality is disposed or reconfigured, the timer may still be active. Add clearTimeout(lastWheelTimer); at the beginning of the cleanup function, similar to how other timers are handled in the codebase (e.g., tracker.ts).
      cleanup() {
        renderer.root.off(EVENTS_NS);
        // @ts-expect-error
        zoomAndPan.actionData?.rect?.dispose();
        // @ts-expect-error
        zoomAndPan.actionData = null;
        renderer.root.css({ 'touch-action': '' });
      },

init() {
const chart = this;
const renderer = this._renderer;
let lastWheelTimer: number | undefined;
Copy link
Contributor

@EugeniyKiyashko EugeniyKiyashko Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor]

Suggested change
let lastWheelTimer: number | undefined;
let lastWheelTimer?: ReturnType<typeof setTimeout>;

@anna-shakhova anna-shakhova merged commit 780ecc1 into DevExpress:25_2 Dec 1, 2025
115 of 116 checks passed
@anna-shakhova anna-shakhova deleted the 25_2__T1314606_zoom_chart branch December 1, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants