@github/hotkey
Advanced tools
Comparing version 1.2.4 to 1.3.0
@@ -164,17 +164,6 @@ function _classCallCheck(instance, Constructor) { | ||
} | ||
function isActivableFormField(element) { | ||
if (!(element instanceof HTMLElement)) { | ||
return false; | ||
} | ||
var name = element.nodeName.toLowerCase(); | ||
var type = (element.getAttribute('type') || '').toLowerCase(); | ||
return name === 'input' && (type === 'checkbox' || type === 'radio'); | ||
} | ||
function fireDeterminedAction(el) { | ||
if (isFormField(el)) { | ||
el.focus(); | ||
} else if (el instanceof HTMLAnchorElement && el.href || el.tagName === 'BUTTON' || el.tagName === 'SUMMARY' || isActivableFormField(el)) { | ||
} else { | ||
el.click(); | ||
@@ -181,0 +170,0 @@ } |
@@ -170,17 +170,6 @@ (function (global, factory) { | ||
} | ||
function isActivableFormField(element) { | ||
if (!(element instanceof HTMLElement)) { | ||
return false; | ||
} | ||
var name = element.nodeName.toLowerCase(); | ||
var type = (element.getAttribute('type') || '').toLowerCase(); | ||
return name === 'input' && (type === 'checkbox' || type === 'radio'); | ||
} | ||
function fireDeterminedAction(el) { | ||
if (isFormField(el)) { | ||
el.focus(); | ||
} else if (el instanceof HTMLAnchorElement && el.href || el.tagName === 'BUTTON' || el.tagName === 'SUMMARY' || isActivableFormField(el)) { | ||
} else { | ||
el.click(); | ||
@@ -187,0 +176,0 @@ } |
{ | ||
"name": "@github/hotkey", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.umd.js", |
@@ -5,3 +5,3 @@ # Hotkey Behavior | ||
on the keyboard. This triggers a focus event on form fields, or a click event on | ||
`<a href="...">`, `<button>` and `<summary>` elements. | ||
others. | ||
@@ -33,2 +33,4 @@ By default, hotkeys are extracted from a target element's `data-hotkey` | ||
### Character Key Shortcuts | ||
Please note that adding this functionality to your site can be a drawback for | ||
@@ -42,2 +44,6 @@ certain users. Providing a way in your system to disable hotkeys or remap | ||
### Interactive Elements | ||
Wherever possible, hotkeys should be add to [interactive and focusable elements](https://html.spec.whatwg.org/#interactive-content). If a static element must be used, please follow the guideline in ["Adding keyboard-accessible actions to static HTML elements"](https://www.w3.org/WAI/WCAG21/Techniques/client-side-script/SCR29.html). | ||
## Installation | ||
@@ -44,0 +50,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104
22800
498
1