Skip to content

onStartTyping

Package
Share - Core
Category
Description
fires when users start typing on non-editable elements

Fires when users start typing on non-editable elements.

Demo

Type anything

Usage

vue
<input ref="input" type="text" placeholder="Start typing to focus" />
ts
import { onStartTyping } from '@hungpvq/shared-core';

export default {
  setup() {
    const input = ref(null);

    onStartTyping(() => {
      if (!input.value.active) input.value.focus();
    });

    return {
      input,
    };
  },
};