keyborg 2.1.0 → 2.2.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.
package/dist/index.js CHANGED
@@ -296,7 +296,7 @@ class KeyborgCore {
296
296
  };
297
297
 
298
298
  this._onKeyDown = e => {
299
- var _a;
299
+ var _a, _b;
300
300
 
301
301
  const isNavigatingWithKeyboard = _state.getVal();
302
302
 
@@ -304,8 +304,16 @@ class KeyborgCore {
304
304
  const triggerKeys = this._triggerKeys;
305
305
 
306
306
  if (!isNavigatingWithKeyboard && (!triggerKeys || triggerKeys.has(keyCode))) {
307
+ const activeElement = (_a = this._win) === null || _a === void 0 ? void 0 : _a.document.activeElement;
308
+
309
+ if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA" || activeElement.contentEditable === "true")) {
310
+ // We're inside an input, textarea or contenteditable, it's not
311
+ // keyboard navigation, it is text editing scenario.
312
+ return;
313
+ }
314
+
307
315
  _state.setVal(true);
308
- } else if (isNavigatingWithKeyboard && ((_a = this._dismissKeys) === null || _a === void 0 ? void 0 : _a.has(keyCode))) {
316
+ } else if (isNavigatingWithKeyboard && ((_b = this._dismissKeys) === null || _b === void 0 ? void 0 : _b.has(keyCode))) {
309
317
  this._scheduleDismiss();
310
318
  }
311
319
  };
@@ -522,7 +530,7 @@ function disposeKeyborg(instance) {
522
530
  * Copyright (c) Microsoft Corporation. All rights reserved.
523
531
  * Licensed under the MIT License.
524
532
  */
525
- const version = "2.1.0";
533
+ const version = "2.2.0";
526
534
 
527
535
  exports.KEYBORG_FOCUSIN = KEYBORG_FOCUSIN;
528
536
  exports.Keyborg = Keyborg;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;"}
@@ -292,7 +292,7 @@ class KeyborgCore {
292
292
  };
293
293
 
294
294
  this._onKeyDown = e => {
295
- var _a;
295
+ var _a, _b;
296
296
 
297
297
  const isNavigatingWithKeyboard = _state.getVal();
298
298
 
@@ -300,8 +300,16 @@ class KeyborgCore {
300
300
  const triggerKeys = this._triggerKeys;
301
301
 
302
302
  if (!isNavigatingWithKeyboard && (!triggerKeys || triggerKeys.has(keyCode))) {
303
+ const activeElement = (_a = this._win) === null || _a === void 0 ? void 0 : _a.document.activeElement;
304
+
305
+ if (activeElement && (activeElement.tagName === "INPUT" || activeElement.tagName === "TEXTAREA" || activeElement.contentEditable === "true")) {
306
+ // We're inside an input, textarea or contenteditable, it's not
307
+ // keyboard navigation, it is text editing scenario.
308
+ return;
309
+ }
310
+
303
311
  _state.setVal(true);
304
- } else if (isNavigatingWithKeyboard && ((_a = this._dismissKeys) === null || _a === void 0 ? void 0 : _a.has(keyCode))) {
312
+ } else if (isNavigatingWithKeyboard && ((_b = this._dismissKeys) === null || _b === void 0 ? void 0 : _b.has(keyCode))) {
305
313
  this._scheduleDismiss();
306
314
  }
307
315
  };
@@ -518,7 +526,7 @@ function disposeKeyborg(instance) {
518
526
  * Copyright (c) Microsoft Corporation. All rights reserved.
519
527
  * Licensed under the MIT License.
520
528
  */
521
- const version = "2.1.0";
529
+ const version = "2.2.0";
522
530
 
523
531
  export { KEYBORG_FOCUSIN, Keyborg, createKeyborg, disposeKeyborg, getLastFocusedProgrammatically, nativeFocus, version };
524
532
  //# sourceMappingURL=keyborg.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyborg.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.0",
4
4
  "description": "Keyboard Navigation Detection for Web",
5
5
  "author": "Marat Abdullin <marata@microsoft.com>",
6
6
  "license": "MIT",