Skip to content

Commit 0097f21

Browse files
authored
fix(ui5-file-uploader): open browse dialog with Space and Enter keys (#3026)
Fixes: #3001
1 parent 9d3b89e commit 0097f21

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/main/src/FileUploader.hbs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
@mouseout="{{_onmouseout}}"
55
@focusin="{{_onfocusin}}"
66
@focusout="{{_onfocusout}}"
7+
@keydown="{{_onkeydown}}"
8+
@keyup="{{_onkeyup}}"
79
>
810
<div class="ui5-file-uploader-mask">
911
{{#unless hideInput}}

packages/main/src/FileUploader.js

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
fetchI18nBundle,
77
getI18nBundle,
88
} from "@ui5/webcomponents-base/dist/i18nBundle.js";
9+
import { isEnter, isSpace } from "@ui5/webcomponents-base/dist/Keys.js";
910
import {
1011
FILEUPLOAD_BROWSE,
1112
FILEUPLOADER_TITLE,
@@ -284,6 +285,18 @@ class FileUploader extends UI5Element {
284285
});
285286
}
286287

288+
_onkeydown(event) {
289+
if (isEnter(event)) {
290+
this._input.click(event);
291+
}
292+
}
293+
294+
_onkeyup(event) {
295+
if (isSpace(event)) {
296+
this._input.click(event);
297+
}
298+
}
299+
287300
_onfocusin() {
288301
this.focused = true;
289302
}

0 commit comments

Comments
 (0)