Skip to content

Commit

Permalink
Prevent buttons in controls from acting like form submit buttons
Browse files Browse the repository at this point in the history
fixes #2934
  • Loading branch information
Lucas Wojciechowski committed Aug 3, 2016
1 parent 3a859f3 commit 653eafb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/ui/control/geolocate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Geolocate.prototype = util.inherit(Control, {
this._container.addEventListener('contextmenu', this._onContextMenu.bind(this));

this._geolocateButton = DOM.create('button', (className + '-icon ' + className + '-geolocate'), this._container);
this._geolocateButton.type = 'button';
this._geolocateButton.addEventListener('click', this._onClickGeolocate.bind(this));
return container;
},
Expand Down
1 change: 1 addition & 0 deletions js/ui/control/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Navigation.prototype = util.inherit(Control, {

_createButton: function(className, fn) {
var a = DOM.create('button', className, this._container);
a.type = 'button';
a.addEventListener('click', function() { fn(); });
return a;
},
Expand Down
1 change: 1 addition & 0 deletions js/ui/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{

if (this.options.closeButton) {
this._closeButton = DOM.create('button', 'mapboxgl-popup-close-button', this._content);
this._closeButton.type = 'button';
this._closeButton.innerHTML = '×';
this._closeButton.addEventListener('click', this._onClickClose);
}
Expand Down

0 comments on commit 653eafb

Please sign in to comment.