Skip to content

Commit

Permalink
Fix keyboard unbindings.
Browse files Browse the repository at this point in the history
There was a bug when unbinding key handlers.  Mousetrap always expects
an array of key sequences, and we were passing one at a time.

Also, jQuery's toggleClass treats 0 as true, so ensure that we always
use a boolean.
  • Loading branch information
manthey committed Jan 11, 2018
1 parent cd102dc commit ccd5a96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mapInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ var mapInteractor = function (args) {
m_boundKeys = bound;
}
$node.toggleClass('highlight-focus',
m_boundKeys && m_boundKeys.length && m_options.keyboard.focusHighlight);
!!(m_boundKeys && m_boundKeys.length && m_options.keyboard.focusHighlight));

// bind touch events
if ((m_this.hasTouchSupport() || m_options.alwaysTouch) &&
Expand Down Expand Up @@ -748,7 +748,7 @@ var mapInteractor = function (args) {
this._disconnectEvents = function () {
if (m_boundKeys) {
if (m_keyHandler) {
m_boundKeys.every(m_keyHandler.unbind, m_keyHandler);
m_keyHandler.unbind(m_boundKeys);
}
m_boundKeys = null;
m_keyHandler = null;
Expand Down

0 comments on commit ccd5a96

Please sign in to comment.