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/Util | |
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/Util')
-rw-r--r-- | core/src/Util/a11y.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/src/Util/a11y.js b/core/src/Util/a11y.js new file mode 100644 index 00000000000..b1eedb3984f --- /dev/null +++ b/core/src/Util/a11y.js @@ -0,0 +1,36 @@ +/** + * @copyright 2022 Christopher Ng <chrng8@gmail.com> + * + * @author Christopher Ng <chrng8@gmail.com> + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/** + * @param {Event} event DOM event + * + * @return {boolean} + */ +export const isA11yClick = (event) => { + if (event.type === 'click') { + return true + } + if (event.type === 'keydown' && event.key === 'Enter') { + return true + } + return false +} |