@eui/ecl 17.0.0-rc.2 → 17.0.0-rc.3

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.
@@ -45,7 +45,7 @@ import '@angular/common/locales/global/sv';
45
45
  import Pikaday from 'pikaday';
46
46
  import * as i1$5 from '@angular/platform-browser';
47
47
  import Hammer from 'hammerjs';
48
- import { ENTER, TAB, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW } from '@angular/cdk/keycodes';
48
+ import { ENTER } from '@angular/cdk/keycodes';
49
49
 
50
50
  class EclBaseEvent {
51
51
  get defaultPrevented() {
@@ -6999,6 +6999,11 @@ class EclMenuMegaComponent extends ECLBaseDirective {
6999
6999
  this.onPrevMenuItemFocus(item);
7000
7000
  break;
7001
7001
  }
7002
+ case KeyCode.ESCAPE: {
7003
+ evt.preventDefault();
7004
+ this.menuMegaItemParentFocus.next(new EclMenuItemSelectEvent(item));
7005
+ break;
7006
+ }
7002
7007
  default: {
7003
7008
  break;
7004
7009
  }
@@ -7074,7 +7079,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
7074
7079
  }] } });
7075
7080
 
7076
7081
  class EclMenuItemComponent extends ECLBaseDirective {
7077
- // isVisible = true;
7078
7082
  get cssClasses() {
7079
7083
  return [
7080
7084
  super.getCssClasses('ecl-menu__item'),
@@ -7097,11 +7101,12 @@ class EclMenuItemComponent extends ECLBaseDirective {
7097
7101
  get children() {
7098
7102
  return this.hasChildren ? this.submenu.eclMenuMegaItems.toArray() : [];
7099
7103
  }
7100
- constructor(el, renderer, arf) {
7104
+ constructor(el, renderer, arf, cdkBreakpointObserver) {
7101
7105
  super();
7102
7106
  this.el = el;
7103
7107
  this.renderer = renderer;
7104
7108
  this.arf = arf;
7109
+ this.cdkBreakpointObserver = cdkBreakpointObserver;
7105
7110
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7106
7111
  this.routerLink = null;
7107
7112
  this.queryParams = null;
@@ -7109,11 +7114,11 @@ class EclMenuItemComponent extends ECLBaseDirective {
7109
7114
  this.href = '';
7110
7115
  this.target = '';
7111
7116
  this.isCurrent = false;
7112
- this.isHovered = false;
7113
- this.isVisible = true;
7114
7117
  this.isFull = false;
7115
- // isHovered = false;
7118
+ this.isHovered = false;
7116
7119
  this.isMobileBreakpoint = false;
7120
+ this.isVisible = true;
7121
+ this.role = 'listitem';
7117
7122
  this.menuItemSelect = new EventEmitter();
7118
7123
  this.menuItemCaret = new EventEmitter();
7119
7124
  this.menuItemHover = new EventEmitter();
@@ -7165,19 +7170,19 @@ class EclMenuItemComponent extends ECLBaseDirective {
7165
7170
  this.isExpanded = false;
7166
7171
  }
7167
7172
  onFocusFromNext() {
7168
- // TODO v17 fix
7169
- // if (this.menuButton) {
7170
- // this.onButtonFocus();
7171
- // } else {
7172
- // this.onLinkFocus();
7173
- // }
7173
+ if (this.menuButton) {
7174
+ this.onButtonFocus();
7175
+ }
7176
+ else {
7177
+ this.onLinkFocus();
7178
+ }
7174
7179
  }
7175
7180
  onFocusFromPrev() {
7176
7181
  this.onLinkFocus();
7177
7182
  }
7178
7183
  onButtonKeydown(evt) {
7179
- switch (evt.keyCode) {
7180
- case DOWN_ARROW: {
7184
+ switch (evt.key) {
7185
+ case KeyCode.ARROW_DOWN: {
7181
7186
  evt.preventDefault();
7182
7187
  if (this.isHovered) {
7183
7188
  this.selectFirstMegaMenuItem();
@@ -7187,26 +7192,31 @@ class EclMenuItemComponent extends ECLBaseDirective {
7187
7192
  }
7188
7193
  break;
7189
7194
  }
7190
- case UP_ARROW: {
7195
+ case KeyCode.ARROW_UP: {
7191
7196
  evt.preventDefault();
7192
7197
  this.onLinkFocus();
7193
7198
  break;
7194
7199
  }
7195
- case RIGHT_ARROW: {
7200
+ case KeyCode.ARROW_RIGHT: {
7196
7201
  evt.preventDefault();
7197
7202
  this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7198
7203
  break;
7199
7204
  }
7200
- case LEFT_ARROW: {
7205
+ case KeyCode.ARROW_LEFT: {
7201
7206
  evt.preventDefault();
7202
7207
  this.onLinkFocus();
7203
7208
  break;
7204
7209
  }
7205
- case TAB: {
7210
+ case KeyCode.TAB: {
7206
7211
  this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7207
7212
  break;
7208
7213
  }
7209
- case ENTER: {
7214
+ case KeyCode.ENTER: {
7215
+ evt.preventDefault();
7216
+ this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7217
+ break;
7218
+ }
7219
+ case KeyCode.ESCAPE: {
7210
7220
  evt.preventDefault();
7211
7221
  this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7212
7222
  break;
@@ -7217,32 +7227,37 @@ class EclMenuItemComponent extends ECLBaseDirective {
7217
7227
  }
7218
7228
  }
7219
7229
  onLinkKeydown(evt) {
7220
- switch (evt.keyCode) {
7221
- case DOWN_ARROW: {
7230
+ switch (evt.key) {
7231
+ case KeyCode.ARROW_DOWN: {
7222
7232
  evt.preventDefault();
7223
7233
  this.onLinkNextFocus(evt);
7224
7234
  break;
7225
7235
  }
7226
- case UP_ARROW: {
7236
+ case KeyCode.ARROW_UP: {
7227
7237
  evt.preventDefault();
7228
7238
  this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7229
7239
  break;
7230
7240
  }
7231
- case RIGHT_ARROW: {
7241
+ case KeyCode.ARROW_RIGHT: {
7232
7242
  evt.preventDefault();
7233
7243
  this.onLinkNextFocus(evt);
7234
7244
  break;
7235
7245
  }
7236
- case LEFT_ARROW: {
7246
+ case KeyCode.ARROW_LEFT: {
7237
7247
  evt.preventDefault();
7238
7248
  this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7239
7249
  break;
7240
7250
  }
7241
- case ENTER: {
7251
+ case KeyCode.ENTER: {
7242
7252
  evt.preventDefault();
7243
7253
  this.onItemClick(evt);
7244
7254
  break;
7245
7255
  }
7256
+ case KeyCode.ESCAPE: {
7257
+ evt.preventDefault();
7258
+ this.onLinkEscape(evt);
7259
+ break;
7260
+ }
7246
7261
  default: {
7247
7262
  break;
7248
7263
  }
@@ -7265,6 +7280,15 @@ class EclMenuItemComponent extends ECLBaseDirective {
7265
7280
  }
7266
7281
  this.renderer.removeStyle(currentItem, 'alignItems');
7267
7282
  }
7283
+ onLinkEscape(evt) {
7284
+ if (this.menuButton) {
7285
+ this.menuButton.el.nativeElement.focus();
7286
+ evt.stopPropagation();
7287
+ }
7288
+ else {
7289
+ this.menuLink.nativeElement.blur();
7290
+ }
7291
+ }
7268
7292
  selectFirstMegaMenuItem() {
7269
7293
  this.submenu.selectFirstSubItem();
7270
7294
  }
@@ -7272,16 +7296,15 @@ class EclMenuItemComponent extends ECLBaseDirective {
7272
7296
  this.menuLink.nativeElement.focus();
7273
7297
  }
7274
7298
  onLinkNextFocus(evt) {
7275
- // TODO v17 fix
7276
- // if (this.menuButton) {
7277
- // this.onButtonFocus();
7278
- // } else {
7279
- // this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt as KeyboardEvent));
7280
- // }
7299
+ if (this.menuButton) {
7300
+ this.onButtonFocus();
7301
+ }
7302
+ else {
7303
+ this.menuItemKeydown.next(new EclMenuItemKeydownEvent(this, evt));
7304
+ }
7281
7305
  }
7282
7306
  onButtonFocus() {
7283
- // TODO v17 fix
7284
- // this.menuButton.el.nativeElement.focus();
7307
+ this.menuButton.el.nativeElement.focus();
7285
7308
  }
7286
7309
  getMenuItemLinkMaxHeight(linkStyle, maxLines) {
7287
7310
  return parseInt(linkStyle.lineHeight, 10) * maxLines + parseInt(linkStyle.paddingTop, 10) + parseInt(linkStyle.paddingBottom, 10);
@@ -7330,21 +7353,20 @@ class EclMenuItemComponent extends ECLBaseDirective {
7330
7353
  return this.submenu && !!this.submenu.eclMenuMegaItems.find((it) => it.isCurrent);
7331
7354
  }
7332
7355
  observeBreakpointChanges() {
7333
- // TODO v17 fix
7334
- // this.cdkBreakpointObserver
7335
- // .observe([Breakpoints.Handset, Breakpoints.Tablet, Breakpoints.Small])
7336
- // .pipe(takeUntil(this.destroy$))
7337
- // .subscribe((result) => {
7338
- // this.isMobileBreakpoint = result.matches;
7339
- // });
7356
+ this.cdkBreakpointObserver
7357
+ .observe([Breakpoints.Handset, Breakpoints.Tablet, Breakpoints.Small])
7358
+ .pipe(takeUntil$1(this.destroy$))
7359
+ .subscribe((result) => {
7360
+ this.isMobileBreakpoint = result.matches;
7361
+ });
7340
7362
  }
7341
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: EclMenuItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Component }); }
7342
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.2", type: EclMenuItemComponent, selector: "ecl-menu-item", inputs: { id: "id", label: "label", routerLink: "routerLink", queryParams: "queryParams", queryParamsHandling: "queryParamsHandling", href: "href", target: "target", isCurrent: "isCurrent" }, outputs: { menuItemSelect: "menuItemSelect", menuItemCaret: "menuItemCaret", menuItemHover: "menuItemHover", menuItemHoverOut: "menuItemHoverOut", menuMegaItemSelect: "menuMegaItemSelect", menuItemFocus: "menuItemFocus", menuItemKeydown: "menuItemKeydown" }, host: { listeners: { "mouseenter": "onItemMouseEnter($event)", "mouseleave": "onItemMouseLeave($event)" }, properties: { "class": "this.cssClasses", "class.ecl-menu__item--has-children": "this.hasEclChildrenDataAttribute", "attr.aria-haspopup": "this.hasEclChildrenDataAttribute", "attr.aria-expanded": "this.isAriaExpanded" } }, queries: [{ propertyName: "submenu", first: true, predicate: i0.forwardRef(() => EclMenuMegaComponent), descendants: true }], viewQueries: [{ propertyName: "menuLink", first: true, predicate: ["menuLink"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<a\n #menuLink\n *ngIf=\"href\"\n [href]=\"href\"\n [target]=\"target\"\n class=\"ecl-menu__link\"\n [class.ecl-menu__link--current]=\"isCurrent\"\n (focus)=\"onItemFocus($event)\"\n (click)=\"onItemClick($event)\"\n (keydown)=\"onLinkKeydown($event)\">\n {{ label }}\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</a>\n<a\n #menuLink\n *ngIf=\"!href\"\n tabindex=\"0\"\n [routerLink]=\"routerLink\"\n [queryParams]=\"queryParams\"\n [queryParamsHandling]=\"queryParamsHandling\"\n class=\"ecl-menu__link\"\n [class.ecl-menu__link--current]=\"isCurrent\"\n (focus)=\"onItemFocus($event)\"\n (click)=\"onItemClick($event)\"\n (keydown)=\"onLinkKeydown($event)\">\n {{ label }}\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</a>\n<button\n eclButton\n *ngIf=\"hasChildren && isMobileBreakpoint\"\n variant=\"primary\"\n class=\"ecl-menu__button-caret\"\n type=\"button\"\n aria-label=\"Access item's children\"\n (click)=\"onItemCaretClick($event)\"\n (keydown)=\"onButtonKeydown($event)\">\n <ecl-icon icon=\"corner-arrow\" size=\"xs\" transform=\"rotate-180\" class=\"ecl-button__icon\"></ecl-icon>\n</button>\n<button\n eclButton\n *ngIf=\"hasChildren && !isMobileBreakpoint\"\n variant=\"primary\"\n class=\"ecl-menu__button-caret\"\n type=\"button\"\n aria-label=\"Access item's children\"\n (keydown)=\"onButtonKeydown($event)\">\n <ecl-icon icon=\"corner-arrow\" size=\"xs\" transform=\"rotate-180\" class=\"ecl-button__icon\"></ecl-icon>\n</button>\n<ng-content select=\"ecl-menu-mega\"></ng-content>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", dependencies: [{ kind: "component", type: EclButtonComponent, selector: "button[eclButton], button[ecl-button], a[eclButton]", inputs: ["variant", "containerStyleClass"] }, { kind: "component", type: EclIconComponent, selector: "ecl-icon", inputs: ["iconSet", "icon", "size", "color", "transform", "ariaLabelledby", "role", "isInverted", "ariaHidden", "focusable"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], encapsulation: i0.ViewEncapsulation.None }); }
7363
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: EclMenuItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ApplicationRef }, { token: i1$4.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
7364
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.2", type: EclMenuItemComponent, selector: "ecl-menu-item", inputs: { id: "id", label: "label", routerLink: "routerLink", queryParams: "queryParams", queryParamsHandling: "queryParamsHandling", href: "href", target: "target", isCurrent: "isCurrent" }, outputs: { menuItemSelect: "menuItemSelect", menuItemCaret: "menuItemCaret", menuItemHover: "menuItemHover", menuItemHoverOut: "menuItemHoverOut", menuMegaItemSelect: "menuMegaItemSelect", menuItemFocus: "menuItemFocus", menuItemKeydown: "menuItemKeydown" }, host: { listeners: { "mouseenter": "onItemMouseEnter($event)", "mouseleave": "onItemMouseLeave($event)" }, properties: { "attr.role": "this.role", "class": "this.cssClasses", "class.ecl-menu__item--has-children": "this.hasEclChildrenDataAttribute", "attr.aria-haspopup": "this.hasEclChildrenDataAttribute", "attr.aria-expanded": "this.isAriaExpanded" } }, queries: [{ propertyName: "submenu", first: true, predicate: i0.forwardRef(() => EclMenuMegaComponent), descendants: true }], viewQueries: [{ propertyName: "menuLink", first: true, predicate: ["menuLink"], descendants: true }, { propertyName: "menuButton", first: true, predicate: EclButtonComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<a\n #menuLink\n *ngIf=\"href\"\n [href]=\"href\"\n [target]=\"target\"\n class=\"ecl-menu__link\"\n [class.ecl-menu__link--current]=\"isCurrent\"\n (focus)=\"onItemFocus($event)\"\n (click)=\"onItemClick($event)\"\n (keydown)=\"onLinkKeydown($event)\">\n {{ label }}\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</a>\n<a\n #menuLink\n *ngIf=\"!href\"\n tabindex=\"0\"\n [routerLink]=\"routerLink\"\n [queryParams]=\"queryParams\"\n [queryParamsHandling]=\"queryParamsHandling\"\n class=\"ecl-menu__link\"\n [class.ecl-menu__link--current]=\"isCurrent\"\n (focus)=\"onItemFocus($event)\"\n (click)=\"onItemClick($event)\"\n (keydown)=\"onLinkKeydown($event)\">\n {{ label }}\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</a>\n<button\n eclButton\n *ngIf=\"hasChildren && isMobileBreakpoint\"\n variant=\"primary\"\n class=\"ecl-menu__button-caret\"\n type=\"button\"\n aria-label=\"Access item's children\"\n (click)=\"onItemCaretClick($event)\"\n (keydown)=\"onButtonKeydown($event)\">\n <ecl-icon icon=\"corner-arrow\" size=\"xs\" transform=\"rotate-180\" class=\"ecl-button__icon\"></ecl-icon>\n</button>\n<button\n eclButton\n *ngIf=\"hasChildren && !isMobileBreakpoint\"\n variant=\"primary\"\n class=\"ecl-menu__button-caret\"\n type=\"button\"\n aria-label=\"Access item's children\"\n (keydown)=\"onButtonKeydown($event)\">\n <ecl-icon icon=\"corner-arrow\" size=\"xs\" transform=\"rotate-180\" class=\"ecl-button__icon\"></ecl-icon>\n</button>\n<ng-content select=\"ecl-menu-mega\"></ng-content>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n", dependencies: [{ kind: "component", type: EclButtonComponent, selector: "button[eclButton], button[ecl-button], a[eclButton]", inputs: ["variant", "containerStyleClass"] }, { kind: "component", type: EclIconComponent, selector: "ecl-icon", inputs: ["iconSet", "icon", "size", "color", "transform", "ariaLabelledby", "role", "isInverted", "ariaHidden", "focusable"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }], encapsulation: i0.ViewEncapsulation.None }); }
7343
7365
  }
7344
7366
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImport: i0, type: EclMenuItemComponent, decorators: [{
7345
7367
  type: Component,
7346
7368
  args: [{ selector: 'ecl-menu-item', encapsulation: ViewEncapsulation.None, template: "<a\n #menuLink\n *ngIf=\"href\"\n [href]=\"href\"\n [target]=\"target\"\n class=\"ecl-menu__link\"\n [class.ecl-menu__link--current]=\"isCurrent\"\n (focus)=\"onItemFocus($event)\"\n (click)=\"onItemClick($event)\"\n (keydown)=\"onLinkKeydown($event)\">\n {{ label }}\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</a>\n<a\n #menuLink\n *ngIf=\"!href\"\n tabindex=\"0\"\n [routerLink]=\"routerLink\"\n [queryParams]=\"queryParams\"\n [queryParamsHandling]=\"queryParamsHandling\"\n class=\"ecl-menu__link\"\n [class.ecl-menu__link--current]=\"isCurrent\"\n (focus)=\"onItemFocus($event)\"\n (click)=\"onItemClick($event)\"\n (keydown)=\"onLinkKeydown($event)\">\n {{ label }}\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n</a>\n<button\n eclButton\n *ngIf=\"hasChildren && isMobileBreakpoint\"\n variant=\"primary\"\n class=\"ecl-menu__button-caret\"\n type=\"button\"\n aria-label=\"Access item's children\"\n (click)=\"onItemCaretClick($event)\"\n (keydown)=\"onButtonKeydown($event)\">\n <ecl-icon icon=\"corner-arrow\" size=\"xs\" transform=\"rotate-180\" class=\"ecl-button__icon\"></ecl-icon>\n</button>\n<button\n eclButton\n *ngIf=\"hasChildren && !isMobileBreakpoint\"\n variant=\"primary\"\n class=\"ecl-menu__button-caret\"\n type=\"button\"\n aria-label=\"Access item's children\"\n (keydown)=\"onButtonKeydown($event)\">\n <ecl-icon icon=\"corner-arrow\" size=\"xs\" transform=\"rotate-180\" class=\"ecl-button__icon\"></ecl-icon>\n</button>\n<ng-content select=\"ecl-menu-mega\"></ng-content>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n" }]
7347
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ApplicationRef }], propDecorators: { id: [{
7369
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ApplicationRef }, { type: i1$4.BreakpointObserver }], propDecorators: { id: [{
7348
7370
  type: Input
7349
7371
  }], label: [{
7350
7372
  type: Input
@@ -7360,6 +7382,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
7360
7382
  type: Input
7361
7383
  }], isCurrent: [{
7362
7384
  type: Input
7385
+ }], role: [{
7386
+ type: HostBinding,
7387
+ args: ['attr.role']
7363
7388
  }], cssClasses: [{
7364
7389
  type: HostBinding,
7365
7390
  args: ['class']
@@ -7369,6 +7394,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.2", ngImpor
7369
7394
  }], menuLink: [{
7370
7395
  type: ViewChild,
7371
7396
  args: ['menuLink']
7397
+ }], menuButton: [{
7398
+ type: ViewChild,
7399
+ args: [EclButtonComponent]
7372
7400
  }], menuItemSelect: [{
7373
7401
  type: Output
7374
7402
  }], menuItemCaret: [{
@@ -7698,11 +7726,21 @@ class EclMenuComponent extends ECLBaseDirective {
7698
7726
  this.onRootMenuItemEnter(item);
7699
7727
  break;
7700
7728
  }
7729
+ case KeyCode.ESCAPE: {
7730
+ this.onRootMenuItemEscape(item, evt.domEvent);
7731
+ break;
7732
+ }
7701
7733
  default: {
7702
7734
  break;
7703
7735
  }
7704
7736
  }
7705
7737
  }
7738
+ onRootMenuItemEscape(item, evt) {
7739
+ if (item.isHovered) {
7740
+ this.closeRootMenu();
7741
+ }
7742
+ evt.stopPropagation();
7743
+ }
7706
7744
  onPrevMenuItemFocus(item) {
7707
7745
  const index = this.findIndexInArray(item);
7708
7746
  if (index !== 0) {