microsoft/keyborg

Any keypress from editable elements does not set keyboard navigation mode

ling1726 opened this issue · 0 comments

keyborg/src/Keyborg.ts

Lines 244 to 253 in 197b994

if (
activeElement &&
(activeElement.tagName === "INPUT" ||
activeElement.tagName === "TEXTAREA" ||
activeElement.contentEditable === "true")
) {
// We're inside an input, textarea or contenteditable, it's not
// keyboard navigation, it is text editing scenario.
return;
}

The current keyboard navigation check is done so that any keypress (even ones explicitly set by the user) will not trigger keyboard navigation mode. This results in keys like Tab not triggering keyboard navigation mode:

Repro: https://codesandbox.io/p/sandbox/laughing-julien-fzkln2?file=%2Fsrc%2Fexample.tsx

  1. Click on the input
  2. Press tab
  3. First button does not have a focus outline