diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-05-31 01:22:37 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-06-09 00:17:19 +0000 |
commit | 189926b107945adfa3e4c7c9542d15a1ace0340a (patch) | |
tree | 67c54aeb330058720635673fffde2765e8aea2fd /core/src/OC | |
parent | 9f09caaaeacb8488a058b956357f363ddfd2fc9e (diff) | |
download | nextcloud-server-189926b107945adfa3e4c7c9542d15a1ace0340a.tar.gz nextcloud-server-189926b107945adfa3e4c7c9542d15a1ace0340a.zip |
Add a11y utility function
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'core/src/OC')
-rw-r--r-- | core/src/OC/dialogs.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js index e32cb6f936e..6f9d7accb6b 100644 --- a/core/src/OC/dialogs.js +++ b/core/src/OC/dialogs.js @@ -49,6 +49,7 @@ import $ from 'jquery' import OC from './index' import OCA from '../OCA/index' +import { isA11yClick } from '../Util/a11y' /** * this class to ease the usage of jquery dialogs @@ -312,7 +313,7 @@ const Dialogs = { self.$showGridView = $('button#picker-showgridview') self.$showGridView.on('click keydown', function(event) { - if (event.type === 'click' || (event.type === 'keydown' && event.key === 'Enter')) { + if (isA11yClick(event)) { self._onGridviewChange() } }) @@ -352,7 +353,7 @@ const Dialogs = { var $input = $form.find('input[type=\'text\']') var $submit = $form.find('input[type=\'submit\']') $input.on('keydown', function(event) { - if (event.key === 'Enter') { + if (isA11yClick(event)) { event.stopImmediatePropagation() event.preventDefault() $form.submit() @@ -444,17 +445,17 @@ const Dialogs = { self.$filelistContainer = self.$filePicker.find('.filelist-container') self.$dirTree = self.$filePicker.find('.dirtree') self.$dirTree.on('click keydown', 'div:not(:last-child)', self, function(event) { - if (event.type === 'click' || (event.type === 'keydown' && event.key === 'Enter')) { + if (isA11yClick(event)) { self._handleTreeListSelect(event, type) } }) self.$filelist.on('click keydown', 'tr', function(event) { - if (event.type === 'click' || (event.type === 'keydown' && event.key === 'Enter')) { + if (isA11yClick(event)) { self._handlePickerClick(event, $(this), type) } }) self.$fileListHeader.on('click keydown', 'a', function(event) { - if (event.type === 'click' || (event.type === 'keydown' && event.key === 'Enter')) { + if (isA11yClick(event)) { var dir = self.$filePicker.data('path') self.filepicker.sortField = $(event.currentTarget).data('sort') self.filepicker.sortOrder = self.filepicker.sortOrder === 'asc' ? 'desc' : 'asc' |