diff --git a/packages/application/src/index.ts b/packages/application/src/index.ts index c0f50948e..eeff4ed28 100644 --- a/packages/application/src/index.ts +++ b/packages/application/src/index.ts @@ -506,6 +506,8 @@ export class Application { // Mark the application as started; this._started = true; + this._bubblingKeydown = options.bubblingKeydown || false; + // Parse the host ID for attaching the shell. const hostID = options.hostID || ''; @@ -606,8 +608,11 @@ export class Application { * A subclass may reimplement this method as needed. */ protected addEventListeners(): void { + if (this._bubblingKeydown) { + console.log('The keydown events are handled during bubbling phase'); + } document.addEventListener('contextmenu', this); - document.addEventListener('keydown', this, true); + document.addEventListener('keydown', this, !this._bubblingKeydown); window.addEventListener('resize', this); } @@ -663,6 +668,7 @@ export class Application { private _plugins = new Map(); private _services = new Map, string>(); private _started = false; + private _bubblingKeydown = false; } /** @@ -715,6 +721,8 @@ export namespace Application { * This will override `startPlugins` and any `autoStart` plugins. */ ignorePlugins?: string[]; + + bubblingKeydown?: boolean; } }