@angular/material 13.3.8 → 13.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2368,6 +2368,21 @@ class MatDatepickerBase {
2368
2368
  }
2369
2369
  this.close();
2370
2370
  });
2371
+ // The `preventDefault` call happens inside the calendar as well, however focus moves into
2372
+ // it inside a timeout which can give browsers a chance to fire off a keyboard event in-between
2373
+ // that can scroll the page (see #24969). Always block default actions of arrow keys for the
2374
+ // entire overlay so the page doesn't get scrolled by accident.
2375
+ overlayRef.keydownEvents().subscribe(event => {
2376
+ const keyCode = event.keyCode;
2377
+ if (keyCode === UP_ARROW ||
2378
+ keyCode === DOWN_ARROW ||
2379
+ keyCode === LEFT_ARROW ||
2380
+ keyCode === RIGHT_ARROW ||
2381
+ keyCode === PAGE_UP ||
2382
+ keyCode === PAGE_DOWN) {
2383
+ event.preventDefault();
2384
+ }
2385
+ });
2371
2386
  this._componentRef = overlayRef.attach(portal);
2372
2387
  this._forwardContentValues(this._componentRef.instance);
2373
2388
  // Update the position once the calendar has rendered. Only relevant in dropdown mode.