aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/Util/a11y.js
blob: 2eb753b3faf5b1ed5dc7a594f1f749990290b335 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

/**
 * Return whether the DOM event is an accessible mouse or keyboard element activation
 *
 * @param {Event} event DOM event
 *
 * @return {boolean}
 */
export const isA11yActivation = (event) => {
	if (event.type === 'click') {
		return true
	}
	if (event.type === 'keydown' && event.key === 'Enter') {
		return true
	}
	return false
}