# keyboard-only-outlines

> Disable outlines displayed when using navigation methods other than keyboard navigation (e.g.: tab).

Latest version **1.0.4** (published 2019-07-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install keyboard-only-outlines
pnpm add keyboard-only-outlines
yarn add keyboard-only-outlines
bun add keyboard-only-outlines
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-07-24 |
| First published | 2018-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | João Mota |
| Maintainers | acostalima, afonsovreis, dominguesgm, filipediasf, fsdiogo, hugomrdias, ivolimasilva, joaomota, marcooliveira, moxyhq, nlfonseca, paulobmarcos, pedromiguelss, ricardo-silva91, ruimonteiro, ruipneves, satazor, vascosantos |
| Keywords | outline, focus, tab, click, keyboard |

## Links

- npm: https://www.npmjs.com/package/keyboard-only-outlines
- Repository: https://github.com/moxystudio/js-keyboard-only-outlines
- Homepage: https://github.com/moxystudio/js-keyboard-only-outlines#readme
- Issues: https://github.com/moxystudio/js-keyboard-only-outlines/issues
- npm.io page: https://npm.io/package/keyboard-only-outlines

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2019-07-24
- 1.0.3 — 2019-05-21
- 1.0.2 — 2019-03-12
- 1.0.1 — 2018-10-19
- 1.0.0 — 2018-10-17

## README

# keyboard-only-outlines

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][codecov-image]][codecov-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]

[npm-url]:https://npmjs.org/package/keyboard-only-outlines
[downloads-image]:https://img.shields.io/npm/dm/keyboard-only-outlines.svg
[npm-image]:https://img.shields.io/npm/v/keyboard-only-outlines.svg
[travis-url]:https://travis-ci.org/moxystudio/js-keyboard-only-outlines
[travis-image]:http://img.shields.io/travis/moxystudio/js-keyboard-only-outlines/master.svg
[codecov-url]:https://codecov.io/gh/moxystudio/js-keyboard-only-outlines
[codecov-image]:https://img.shields.io/codecov/c/github/moxystudio/js-keyboard-only-outlines/master.svg
[david-dm-url]:https://david-dm.org/moxystudio/js-keyboard-only-outlines
[david-dm-image]:https://img.shields.io/david/moxystudio/js-keyboard-only-outlines.svg
[david-dm-dev-url]:https://david-dm.org/moxystudio/js-keyboard-only-outlines?type=dev
[david-dm-dev-image]:https://img.shields.io/david/dev/moxystudio/js-keyboard-only-outlines.svg

Disable outlines displayed when using navigation methods other than keyboard navigation (e.g.: tab).

By default, some browsers, such as Firefox and Edge, set input borders on focus according to the host Operating System theme.
This package does not disable borders, as it may interfere with the user's own styles.
This is only apparent when users don't explicitly define a border for their inputs.

You can see it working in the [demo](https://moxystudio.github.io/js-keyboard-only-outlines/demo/) page.


## Installation

```sh
$ npm install keyboard-only-outlines
```

This library is written in modern JavaScript and is published in both CommonJS and ES module transpiled variants. If you target older browsers please make sure to transpile accordingly.


## Usage

```js
import keyboardOnlyOutlines from 'keyboard-only-outlines'

const dispose = keyboardOnlyOutlines()
// dispose will be a function which deactivates this behaviour and can be called at any time

```

The function may also be invoked with the following options:

```js
keyboardOnlyOutlines({ styles: ..., stylesheetTarget: ... })
```

Where `styles` represents the styles to apply when a focus event is caused by mouse navigation, and `stylesheetTarget` is the node which will receive the aforementioned style. The latter option is particularly useful when dealing with ShadowDOMs.

These options have the following default values:

```js
const defaultOptions = {
    styles: `
*:focus {
    outline: none !important;
}
*::-moz-focus-inner {
    border: none !important;
}`,
    stylesheetTarget: document.head,
};
```


## Tests

```sh
$ npm test
$ npm test -- --watch # during development
```


## License

Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).

---
_Source: https://npm.io/package/keyboard-only-outlines · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
