Comparing version 0.2.1 to 0.2.2
@@ -62,3 +62,3 @@ "use strict"; | ||
this.target.addEventListener("keydown", function (event) { | ||
if (event.key === "Escape") { | ||
if (event.keyCode === 27) { | ||
self.close(); | ||
@@ -74,3 +74,3 @@ self.btn.focus(); | ||
var elementLast = elementList.length - 1; | ||
if (event.key === "Tab" && document.activeElement === elementList[elementLast]) { | ||
if (event.keyCode === 9 && document.activeElement === elementList[elementLast]) { | ||
event.preventDefault(); | ||
@@ -81,3 +81,3 @@ elementList[0].focus(); | ||
// Arrow Up/Down navigation | ||
if (event.key === "ArrowUp" || event.key === "ArrowDown") { | ||
if (event.keyCode === 38 || event.keyCode === 40) { | ||
event.preventDefault(); | ||
@@ -88,3 +88,3 @@ var currentItemIndex = self._getCurrentItemIndex(elementList, document.activeElement); | ||
} else { | ||
if (event.key === "ArrowUp") { | ||
if (event.keyCode === 38) { | ||
elementList[self._getPreviousItemIndex(elementList, currentItemIndex)].focus(); | ||
@@ -231,4 +231,4 @@ } else { | ||
this._constructList().appendChild(this._constructItem(btn)); | ||
btn.addEventListener('click', function () { | ||
callback(); | ||
btn.addEventListener('click', function (event) { | ||
callback(event); | ||
}); | ||
@@ -235,0 +235,0 @@ return btn; |
{ | ||
"name": "dropmic", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A lightweight dropdown plugin", | ||
@@ -5,0 +5,0 @@ "main": "dist/dropmic.js", |
@@ -50,3 +50,3 @@ const dropmicClassShow = "dropmic--show"; | ||
this.target.addEventListener("keydown", function(event) { | ||
if(event.key === "Escape") { | ||
if(event.keyCode === 27) { | ||
self.close(); | ||
@@ -63,3 +63,3 @@ self.btn.focus(); | ||
let elementLast = elementList.length - 1; | ||
if(event.key === "Tab" && document.activeElement === elementList[elementLast]) { | ||
if(event.keyCode === 9 && document.activeElement === elementList[elementLast]) { | ||
event.preventDefault(); | ||
@@ -70,3 +70,3 @@ elementList[0].focus(); | ||
// Arrow Up/Down navigation | ||
if(event.key === "ArrowUp" || event.key === "ArrowDown") { | ||
if(event.keyCode === 38 || event.keyCode === 40) { | ||
event.preventDefault(); | ||
@@ -77,3 +77,3 @@ let currentItemIndex = self._getCurrentItemIndex(elementList, document.activeElement); | ||
} else { | ||
if(event.key === "ArrowUp") { | ||
if(event.keyCode === 38) { | ||
elementList[self._getPreviousItemIndex(elementList, currentItemIndex)].focus(); | ||
@@ -80,0 +80,0 @@ } else { |
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
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
38209