about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/containers/dropdown_menu_container.js
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-09-11 22:35:17 +0200
committerThibG <thib@sitedethib.com>2018-09-13 20:32:08 +0200
commit5ff733b614fee51eebbc5f3f8aa2b96339181235 (patch)
tree638fcb5a0032c0c1b1428e6cc38b975308290a96 /app/javascript/flavours/glitch/containers/dropdown_menu_container.js
parentcf142e85569be5e7e0dae7e02f490c737a238319 (diff)
Only focus first item of dropdown if it was opened via keyboard
Diffstat (limited to 'app/javascript/flavours/glitch/containers/dropdown_menu_container.js')
-rw-r--r--app/javascript/flavours/glitch/containers/dropdown_menu_container.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/containers/dropdown_menu_container.js b/app/javascript/flavours/glitch/containers/dropdown_menu_container.js
index 626d500f0..b2419a0fd 100644
--- a/app/javascript/flavours/glitch/containers/dropdown_menu_container.js
+++ b/app/javascript/flavours/glitch/containers/dropdown_menu_container.js
@@ -8,10 +8,11 @@ const mapStateToProps = state => ({
   isModalOpen: state.get('modal').modalType === 'ACTIONS',
   dropdownPlacement: state.getIn(['dropdown_menu', 'placement']),
   openDropdownId: state.getIn(['dropdown_menu', 'openId']),
+  openedViaKeyboard: state.getIn(['dropdown_menu', 'keyboard']),
 });
 
 const mapDispatchToProps = (dispatch, { status, items }) => ({
-  onOpen(id, onItemClick, dropdownPlacement) {
+  onOpen(id, onItemClick, dropdownPlacement, keyboard) {
     dispatch(isUserTouching() ? openModal('ACTIONS', {
       status,
       actions: items.map(
@@ -21,7 +22,7 @@ const mapDispatchToProps = (dispatch, { status, items }) => ({
           onClick: item.action ? ((e) => { return onItemClick(i, e) }) : null,
         } : null
       ),
-    }) : openDropdownMenu(id, dropdownPlacement));
+    }) : openDropdownMenu(id, dropdownPlacement, keyboard));
   },
   onClose(id) {
     dispatch(closeModal());