Comparing version 9.1.1 to 9.2.1
@@ -13,3 +13,5 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
ENTER = KeyCode.ENTER, | ||
ESC = KeyCode.ESC; | ||
ESC = KeyCode.ESC, | ||
HOME = KeyCode.HOME, | ||
END = KeyCode.END; | ||
var ArrowKeys = [UP, DOWN, LEFT, RIGHT]; | ||
@@ -168,3 +170,3 @@ | ||
if ([].concat(ArrowKeys, [ENTER, ESC]).includes(which)) { | ||
if ([].concat(ArrowKeys, [ENTER, ESC, HOME, END]).includes(which)) { | ||
// Convert key to elements | ||
@@ -199,3 +201,3 @@ var elements; | ||
if (!offsetObj) { | ||
if (!offsetObj && which !== HOME && which !== END) { | ||
return; | ||
@@ -205,3 +207,3 @@ } // Arrow prevent default to avoid page scroll | ||
if (ArrowKeys.includes(which)) { | ||
if (ArrowKeys.includes(which) || [HOME, END].includes(which)) { | ||
e.preventDefault(); | ||
@@ -237,3 +239,3 @@ } | ||
if (offsetObj.sibling || !focusMenuElement) { | ||
if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) { | ||
// ========================== Sibling ========================== | ||
@@ -250,4 +252,14 @@ // Find walkable focus menu element container | ||
var targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset); // Focus menu item | ||
var targetElement; | ||
var focusableElements = getFocusableElements(parentQueryContainer, elements); | ||
if (which === HOME) { | ||
targetElement = focusableElements[0]; | ||
} else if (which === END) { | ||
targetElement = focusableElements[focusableElements.length - 1]; | ||
} else { | ||
targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset); | ||
} // Focus menu item | ||
tryFocus(targetElement); // ======================= InlineTrigger ======================= | ||
@@ -254,0 +266,0 @@ } else if (offsetObj.inlineTrigger) { |
@@ -30,3 +30,5 @@ "use strict"; | ||
ENTER = _KeyCode.default.ENTER, | ||
ESC = _KeyCode.default.ESC; | ||
ESC = _KeyCode.default.ESC, | ||
HOME = _KeyCode.default.HOME, | ||
END = _KeyCode.default.END; | ||
var ArrowKeys = [UP, DOWN, LEFT, RIGHT]; | ||
@@ -185,3 +187,3 @@ | ||
if ([].concat(ArrowKeys, [ENTER, ESC]).includes(which)) { | ||
if ([].concat(ArrowKeys, [ENTER, ESC, HOME, END]).includes(which)) { | ||
// Convert key to elements | ||
@@ -216,3 +218,3 @@ var elements; | ||
if (!offsetObj) { | ||
if (!offsetObj && which !== HOME && which !== END) { | ||
return; | ||
@@ -222,3 +224,3 @@ } // Arrow prevent default to avoid page scroll | ||
if (ArrowKeys.includes(which)) { | ||
if (ArrowKeys.includes(which) || [HOME, END].includes(which)) { | ||
e.preventDefault(); | ||
@@ -254,3 +256,3 @@ } | ||
if (offsetObj.sibling || !focusMenuElement) { | ||
if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) { | ||
// ========================== Sibling ========================== | ||
@@ -267,4 +269,14 @@ // Find walkable focus menu element container | ||
var targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset); // Focus menu item | ||
var targetElement; | ||
var focusableElements = getFocusableElements(parentQueryContainer, elements); | ||
if (which === HOME) { | ||
targetElement = focusableElements[0]; | ||
} else if (which === END) { | ||
targetElement = focusableElements[focusableElements.length - 1]; | ||
} else { | ||
targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset); | ||
} // Focus menu item | ||
tryFocus(targetElement); // ======================= InlineTrigger ======================= | ||
@@ -271,0 +283,0 @@ } else if (offsetObj.inlineTrigger) { |
{ | ||
"name": "rc-menu", | ||
"version": "9.1.1", | ||
"version": "9.2.1", | ||
"description": "menu ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
4552
1
215095
110
1