mirror of https://github.com/nextcloud/server
Rename a11y helper function
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
343eab4c96
commit
0ea95c3ff6
|
@ -49,7 +49,7 @@ import $ from 'jquery'
|
|||
|
||||
import OC from './index'
|
||||
import OCA from '../OCA/index'
|
||||
import { isA11yClick } from '../Util/a11y'
|
||||
import { isA11yActivation } from '../Util/a11y'
|
||||
|
||||
/**
|
||||
* this class to ease the usage of jquery dialogs
|
||||
|
@ -313,7 +313,7 @@ const Dialogs = {
|
|||
|
||||
self.$showGridView = $('button#picker-showgridview')
|
||||
self.$showGridView.on('click keydown', function(event) {
|
||||
if (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
self._onGridviewChange()
|
||||
}
|
||||
})
|
||||
|
@ -353,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 (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
event.stopImmediatePropagation()
|
||||
event.preventDefault()
|
||||
$form.submit()
|
||||
|
@ -445,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 (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
self._handleTreeListSelect(event, type)
|
||||
}
|
||||
})
|
||||
self.$filelist.on('click keydown', 'tr', function(event) {
|
||||
if (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
self._handlePickerClick(event, $(this), type)
|
||||
}
|
||||
})
|
||||
self.$fileListHeader.on('click keydown', 'a', function(event) {
|
||||
if (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
var dir = self.$filePicker.data('path')
|
||||
self.filepicker.sortField = $(event.currentTarget).data('sort')
|
||||
self.filepicker.sortOrder = self.filepicker.sortOrder === 'asc' ? 'desc' : 'asc'
|
||||
|
|
|
@ -21,11 +21,13 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Return whether the DOM event is an accessible mouse or keyboard element activation
|
||||
*
|
||||
* @param {Event} event DOM event
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isA11yClick = (event) => {
|
||||
export const isA11yActivation = (event) => {
|
||||
if (event.type === 'click') {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
import $ from 'jquery'
|
||||
import { isA11yClick } from '../Util/a11y'
|
||||
import { isA11yActivation } from '../Util/a11y'
|
||||
|
||||
$.widget('oc.ocdialog', {
|
||||
options: {
|
||||
|
@ -61,7 +61,7 @@ $.widget('oc.ocdialog', {
|
|||
if (self.element.find('input').length === 1) {
|
||||
const $input = self.element.find('input')
|
||||
$input.on('keydown', function(event) {
|
||||
if (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
if (self.$buttonrow) {
|
||||
const $button = self.$buttonrow.find('button.primary')
|
||||
if ($button && !$button.prop('disabled')) {
|
||||
|
@ -158,7 +158,7 @@ $.widget('oc.ocdialog', {
|
|||
}
|
||||
self.$buttonrow.append($button)
|
||||
$button.on('click keydown', function(event) {
|
||||
if (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
val.click.apply(self.element[0], arguments)
|
||||
}
|
||||
})
|
||||
|
@ -180,7 +180,7 @@ $.widget('oc.ocdialog', {
|
|||
const $closeButton = $('<a class="oc-dialog-close" tabindex="0"></a>')
|
||||
this.$dialog.prepend($closeButton)
|
||||
$closeButton.on('click keydown', function(event) {
|
||||
if (isA11yClick(event)) {
|
||||
if (isA11yActivation(event)) {
|
||||
self.options.closeCallback && self.options.closeCallback()
|
||||
self.close()
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue