diff --git a/src/KeyboardShortcut/KeyboardShortcut.xml b/src/KeyboardShortcut/KeyboardShortcut.xml index 01dd66f..e0023a8 100644 --- a/src/KeyboardShortcut/KeyboardShortcut.xml +++ b/src/KeyboardShortcut/KeyboardShortcut.xml @@ -20,7 +20,13 @@ xTuWIvAW3RahaSYkTNI5xl6/3TpcVJ3lxR0OSj/J8qLAVvhTsydahIZvcYcpclyZqfzT55nHKKYe Behavior Setting this to true limits the listening to keyboard events if the key is pressed when focus is at an element which is within this container. - + + + Limit scope Button scope + Behavior + Setting this to true limits the triggering of the button to buttons with this container. Very useful for using this widget in a snippet that show multiple times on a page. + + Shortcuts Shortcuts diff --git a/src/KeyboardShortcut/widget/KeyboardShortcut.js b/src/KeyboardShortcut/widget/KeyboardShortcut.js index 80840fc..503afb2 100644 --- a/src/KeyboardShortcut/widget/KeyboardShortcut.js +++ b/src/KeyboardShortcut/widget/KeyboardShortcut.js @@ -31,6 +31,7 @@ define([ shortcuts: [], disableInput: false, limitScope: false, + limitScopeButton: false, //internal variables @@ -79,7 +80,7 @@ define([ var buttonsLength = buttons.length; for (var i = 0; i < buttonsLength; i++) { button = buttons[i]; - if (button.offsetHeight != 0) { + if (button.offsetHeight != 0 && (!self.limitScopeButton || scope.contains(button))) { chosenButton = button; break; } diff --git a/src/package.xml b/src/package.xml index ca1dd4d..5ed3428 100644 --- a/src/package.xml +++ b/src/package.xml @@ -1,6 +1,6 @@ - + @@ -8,4 +8,4 @@ - \ No newline at end of file +