@rescui/focus-manager
v0.1.8
Published
Tiny helper, which adds `data-focus-method` attribute to focused elements.
Downloads
859
Keywords
Readme
Tiny helper, which adds data-focus-method
attribute to focused elements.
Possible values:
mouse
key
touch
Usage
JS:
import FocusManager from '@rescui/focus-manager'
document.addEventListener('DOMContentLoaded', () => {
new FocusManager();
});
CSS:
/* Your custom focus styles */
:focus {
outline: 2px solid #087CFA;
}
/* Disable focus outline for touch and mouse interactions */
:focus[data-focus-method="mouse"],
:focus[data-focus-method="touch"] {
outline: none;
}