Skip to content

Commit

Permalink
Merge pull request #638 from jacobtoye/PreventDefault
Browse files Browse the repository at this point in the history
Prevent default action when opening layers control
  • Loading branch information
mourner committed Jun 18, 2012
2 parents 9a1360b + 4e2fe35 commit a287a6f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/control/Control.Layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ L.Control.Layers = L.Control.extend({
link.href = '#';
link.title = 'Layers';

L.DomEvent.addListener(link, L.Browser.touch ? 'click' : 'focus', this._expand, this);
if (L.Browser.touch) {
L.DomEvent
.addListener(link, 'click', L.DomEvent.stopPropagation)
.addListener(link, 'click', L.DomEvent.preventDefault)
.addListener(link, 'click', this._expand, this);
}
else {
L.DomEvent.addListener(link, 'focus', this._expand, this);
}

this._map.on('movestart', this._collapse, this);
// TODO keyboard accessibility
Expand Down

0 comments on commit a287a6f

Please sign in to comment.