diff options
Diffstat (limited to 'core/src/Util/a11y.js')
-rw-r--r-- | core/src/Util/a11y.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/Util/a11y.js b/core/src/Util/a11y.js new file mode 100644 index 00000000000..2eb753b3faf --- /dev/null +++ b/core/src/Util/a11y.js @@ -0,0 +1,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 +} |