Skip to content

Commit

Permalink
Cancelling "sn:willmove" won't make the default action be taken now
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-chang committed Mar 24, 2016
1 parent 59269fd commit 1da32d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,6 @@ Fired when SpatialNavigation is about to move the focus.

`direction` indicates the direction given by arrow keys or [`move()`](#spatialnavigationmovedirection-selector) method.

**Note:** Cancelling this event makes the default action be taken normally, i.e. key events will be handled by browser as usual.

#### `sn:willunfocus`

+ bubbles: `true`
Expand Down
6 changes: 2 additions & 4 deletions spatial_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@

var currentSectionId = getSectionId(currentFocusedElement);
if (!currentSectionId) {
focusSection();
return;
}

Expand All @@ -888,11 +887,10 @@
cause: 'keydown'
};

if (!fireEvent(currentFocusedElement, 'willmove', willmoveProperties)) {
return;
if (fireEvent(currentFocusedElement, 'willmove', willmoveProperties)) {
focusNext(direction, currentFocusedElement, currentSectionId);
}

focusNext(direction, currentFocusedElement, currentSectionId);
return preventDefault();
}

Expand Down

0 comments on commit 1da32d1

Please sign in to comment.