Skip to content

fix(overlay): Prevent scrolling with wheel and touchpad when BlockScrollStrategy is set on Safari#17274

Open
mddragnev wants to merge 1 commit into
masterfrom
mdragnev/fix-17217
Open

fix(overlay): Prevent scrolling with wheel and touchpad when BlockScrollStrategy is set on Safari#17274
mddragnev wants to merge 1 commit into
masterfrom
mdragnev/fix-17217

Conversation

@mddragnev
Copy link
Copy Markdown
Member

…uchmove

Closes #17217

Description

Prevent scroll from mouse/trackpad/touch before it occurs.
This also fixes the Safari case where the scroll event fires after the compositor has already scrolled, making scroll-position reset ineffective for wheel/touch input.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Copilot AI review requested due to automatic review settings May 14, 2026 11:55
@mddragnev mddragnev added ❌ status: awaiting-test PRs awaiting manual verification overlay labels May 14, 2026
Copy link
Copy Markdown
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

Fixes Safari-specific behavior where BlockScrollStrategy fails to prevent scrolling early enough by intercepting wheel/touch scrolling input before the browser scrolls.

Changes:

  • Add non-passive wheel and touchmove listeners that call preventDefault() to block scroll before it occurs (Safari fix for #17217).
  • Keep the existing capture scroll listener as a fallback for keyboard-driven scrolling.
  • Add cleanup for the new listeners on detach().

this._sourceElement.scrollLeft = this._initialScrollLeft;
};

private preventDefault = (ev: Event) => {
Comment on lines +39 to +43
// This also fixes Safari bug #17217 where the scroll event fires after the compositor has already
// scrolled, making scroll-position reset ineffective for wheel/touch input.
this._document.addEventListener('wheel', this.preventDefault, { passive: false });
this._document.addEventListener('touchmove', this.preventDefault, { passive: false });
// Handles keyboard-driven scrolling (arrow keys, spacebar, Page Up/Down) as a fallback,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

overlay ❌ status: awaiting-test PRs awaiting manual verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Safari] Overlay BlockScrollStrategy does not work as expected

3 participants