unfocused-input-buffer
Ever typed a really long message only to realise the input field wasn't selected? Annoying isn't it?
Why not buffer that bad boy and have it magically appear when the user focuses the field?
What a pleasing user experience they will have!
Installation
yarn add unfocused-input-buffer
or
npm i unfocused-input-buffer --save
Usage
HTML
Add a class or data attribute to all the input fields you want to be buffered.
The default is data-buffered
.
<input type="text" data-buffered />
JavaScript
Import and call the package with the optional options:
import unfocusedInputBuffer from 'unfocused-input-buffer'
unfocusedInputBuffer()
Options
Option | Type | Default | Description |
---|---|---|---|
selector |
String |
[data-buffered] |
CSS selector to identify the target input fields. |
Roadmap
- [ ] Buffer lifespan interval
- [ ] User prompt to insert buffer
Credits
This package is inspired by a paper titled Buffering and Inserting Text Inputs by Winson Chung.