Skip to content

Commit

Permalink
fix(ui5-file-uploader): open browse dialog with Space and Enter keys (#…
Browse files Browse the repository at this point in the history
…3026)

Fixes: #3001
  • Loading branch information
Todor-ads authored and ilhan007 committed Mar 31, 2021
1 parent a80dea6 commit 7f1c874
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/main/src/FileUploader.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
@mouseout="{{_onmouseout}}"
@focusin="{{_onfocusin}}"
@focusout="{{_onfocusout}}"
@keydown="{{_onkeydown}}"
@keyup="{{_onkeyup}}"
>
<div class="ui5-file-uploader-mask">
{{#unless hideInput}}
Expand Down
13 changes: 13 additions & 0 deletions packages/main/src/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
fetchI18nBundle,
getI18nBundle,
} from "@ui5/webcomponents-base/dist/i18nBundle.js";
import { isEnter, isSpace } from "@ui5/webcomponents-base/dist/Keys.js";
import {
FILEUPLOAD_BROWSE,
FILEUPLOADER_TITLE,
Expand Down Expand Up @@ -273,6 +274,18 @@ class FileUploader extends UI5Element {
});
}

_onkeydown(event) {
if (isEnter(event)) {
this._input.click(event);
}
}

_onkeyup(event) {
if (isSpace(event)) {
this._input.click(event);
}
}

_onfocusin() {
this.focused = true;
}
Expand Down

0 comments on commit 7f1c874

Please sign in to comment.