function onFocus(e) {
      // Prevent IE from focusing the document or HTML element.
      if (!isValidFocusTarget(e.target)) {
        return;
      }

      if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
        addFocusVisibleClass(e.target);
      }
    }
On `focus`, add the `focus-visible` class to the target if:
- the target received focus as a result of keyboard navigation, or
- the event target is an element that will likely require interaction
  via the keyboard (e.g. a text box)
@param {Event} e