# Detect if user is on touch screen

Sometimes, it is useful to check if the user is on a touch screen. An example would be NOT to focus the textarea in touch screen. This is because the keyboard does not appear when user taps on the textarea.

Some code to detect touchscreen is shown below

```typescript
const isTouchScreen =
      'ontouchstart' in window ||
      navigator.maxTouchPoints > 0 ||
      // For Internet Explorer
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      (navigator as any).msMaxTouchPoints > 0
```

PS: Code snippets for using them in the future.
