@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.
@@ -2374,6 +2374,21 @@ class MatDatepickerBase {
2374
2374
  }
2375
2375
  this.close();
2376
2376
  });
2377
+ // The `preventDefault` call happens inside the calendar as well, however focus moves into
2378
+ // it inside a timeout which can give browsers a chance to fire off a keyboard event in-between
2379
+ // that can scroll the page (see #24969). Always block default actions of arrow keys for the
2380
+ // entire overlay so the page doesn't get scrolled by accident.
2381
+ overlayRef.keydownEvents().subscribe(event => {
2382
+ const keyCode = event.keyCode;
2383
+ if (keyCode === UP_ARROW ||
2384
+ keyCode === DOWN_ARROW ||
2385
+ keyCode === LEFT_ARROW ||
2386
+ keyCode === RIGHT_ARROW ||
2387
+ keyCode === PAGE_UP ||
2388
+ keyCode === PAGE_DOWN) {
2389
+ event.preventDefault();
2390
+ }
2391
+ });
2377
2392
  this._componentRef = overlayRef.attach(portal);
2378
2393
  this._forwardContentValues(this._componentRef.instance);
2379
2394
  // Update the position once the calendar has rendered. Only relevant in dropdown mode.