Skip to content

Commit

Permalink
Merge pull request w3c#1 from jeonghee27/polyfil-bugfix
Browse files Browse the repository at this point in the history
Fixed a bug of Enter key behavior.
  • Loading branch information
Jihye Hong authored Aug 20, 2018
2 parents c6007b7 + c9e92f2 commit 7d8d39c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion polyfill/spatnav-heuristic.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
* mouseclick EventListener :
* If the mouse click a point in the page, the point will be the starting point.
*/
document.addEventListener('click', function(e) {
document.addEventListener('mouseup', function(e) {
startingPosition = {xPosition: e.clientX, yPosition: e.clientY};
});

Expand Down Expand Up @@ -992,6 +992,10 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
const focusNavigableArrowKey = {'left': false, 'up': false, 'right': false, 'down': false};

const dir = ARROW_KEY_CODE[e.keyCode];
if(dir === undefined) {
return focusNavigableArrowKey;
}

if (spinnableInputTypes.includes(eventTarget.getAttribute('type')) &&
(dir === 'up' || dir === 'down')) {
focusNavigableArrowKey[dir] = true;
Expand Down

0 comments on commit 7d8d39c

Please sign in to comment.