@jossmac/lil-libs
    Preparing search index...

    Function isKeyboardInput

    • Checks whether an event target is an element that can trigger the software keyboard on mobile devices.

      • target: EventTarget | null | undefined

        Event target to test, typically from a DOM event's target property.

      true for text-like <input> types and <textarea> elements that open the software keyboard on mobile; false otherwise.

      const textInput = document.createElement("input");
      textInput.type = "text";

      const checkbox = document.createElement("input");
      checkbox.type = "checkbox";

      isKeyboardInput(textInput); // true
      isKeyboardInput(checkbox); // false
      isKeyboardInput(document.createElement("textarea")); // true
      isKeyboardInput(document.createElement("div")); // false