Skip to content

Commit

Permalink
fix(ui5-date-picker): select date with SPACE on keyup (#2279)
Browse files Browse the repository at this point in the history
This PR complements the following PR #2276
to fix everything requested by the referenced issue, more specifically forcing date selection with SPACE to take place on keyup, instead of keydown as at the moment.

FIXES: #2268
  • Loading branch information
ilhan007 committed Oct 1, 2020
1 parent fac40a8 commit 9d83806
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/main/src/DayPicker.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class="ui5-dp-root"
style="{{styles.wrapper}}"
@keydown={{_onkeydown}}
@keyup={{_onkeyup}}
@mousedown={{_onmousedown}}
@mouseup={{_onmouseup}}
>
Expand Down
9 changes: 8 additions & 1 deletion packages/main/src/DayPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ class DayPicker extends UI5Element {
}

if (isSpace(event)) {
return this._handleSpace(event);
event.preventDefault();
return;
}

if (isHomeCtrl(event)) {
Expand Down Expand Up @@ -481,6 +482,12 @@ class DayPicker extends UI5Element {
}
}

_onkeyup(event) {
if (isSpace(event)) {
this._handleSpace(event);
}
}

_handleEnter(event) {
event.preventDefault();
if (event.target.className.indexOf("ui5-dp-item") > -1) {
Expand Down

0 comments on commit 9d83806

Please sign in to comment.