0.1.12 • Published 9 months ago

@rescui/focus-manager v0.1.12

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
9 months ago

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;
}