https://github.com/ryanve/focux
Match :focus-within for better focus experience
https://github.com/ryanve/focux
focus focus-within javascript opensource
Last synced: over 1 year ago
JSON representation
Match :focus-within for better focus experience
- Host: GitHub
- URL: https://github.com/ryanve/focux
- Owner: ryanve
- License: other
- Created: 2018-01-14T06:19:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-15T04:29:54.000Z (over 8 years ago)
- Last Synced: 2025-03-15T21:51:21.780Z (over 1 year ago)
- Topics: focus, focus-within, javascript, opensource
- Language: HTML
- Homepage: https://ryanve.github.io/focux
- Size: 45.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [`focux`](https://www.npmjs.com/package/focux)
detect [`:focus-within`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within) for better UX
```
npm install focux
```
```js
const focux = require("focux")
```
## api
### `focux.within(element)`
- test if `element` matches `:focus-within` specification
- matches even without native `:focus-within` support
- `element` is a DOM element node
- `@return boolean`
```js
focux.within(element) // true || false
```
## compatibility
- [ES5+](https://caniuse.com/#feat=es5)