@angular/cdk 19.0.3 → 19.0.5

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.
package/fesm2022/menu.mjs CHANGED
@@ -943,6 +943,12 @@ class CdkMenuItem {
943
943
  case ENTER:
944
944
  // Skip events that will trigger clicks so the handler doesn't get triggered twice.
945
945
  if (!hasModifierKey(event) && !eventDispatchesNativeClick(this._elementRef, event)) {
946
+ const nodeName = this._elementRef.nativeElement.nodeName;
947
+ // Avoid repeat events on non-native elements (see #30250). Note that we don't do this
948
+ // on the native elements so we don't interfere with their behavior (see #26296).
949
+ if (nodeName !== 'A' && nodeName !== 'BUTTON') {
950
+ event.preventDefault();
951
+ }
946
952
  this.trigger({ keepOpen: event.keyCode === SPACE && !this.closeOnSpacebarTrigger });
947
953
  }
948
954
  break;