@angular/material 14.0.0-rc.2 → 14.0.0

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.
@@ -2486,6 +2486,21 @@ class MatDatepickerBase {
2486
2486
  }
2487
2487
  this.close();
2488
2488
  });
2489
+ // The `preventDefault` call happens inside the calendar as well, however focus moves into
2490
+ // it inside a timeout which can give browsers a chance to fire off a keyboard event in-between
2491
+ // that can scroll the page (see #24969). Always block default actions of arrow keys for the
2492
+ // entire overlay so the page doesn't get scrolled by accident.
2493
+ overlayRef.keydownEvents().subscribe(event => {
2494
+ const keyCode = event.keyCode;
2495
+ if (keyCode === UP_ARROW ||
2496
+ keyCode === DOWN_ARROW ||
2497
+ keyCode === LEFT_ARROW ||
2498
+ keyCode === RIGHT_ARROW ||
2499
+ keyCode === PAGE_UP ||
2500
+ keyCode === PAGE_DOWN) {
2501
+ event.preventDefault();
2502
+ }
2503
+ });
2489
2504
  this._componentRef = overlayRef.attach(portal);
2490
2505
  this._forwardContentValues(this._componentRef.instance);
2491
2506
  // Update the position once the calendar has rendered. Only relevant in dropdown mode.