mariusandra / pigeon-maps

ReactJS Maps without external dependencies
https://pigeon-maps.js.org/
MIT License
3.43k stars 142 forks source link

BUG: ZoomControl buttons are missing type="button" (cannot use in form) #165

Closed sebastienbarre closed 1 year ago

sebastienbarre commented 1 year ago

Hello,

This took me a bit to figure out, but the <button> HTML elements in the <ZoomControl> component are missing their type="button" attributes.

Since the default type for buttons is submit, this means that <ZoomControl> cannot be used when the map is inside a <form>, otherwise clicking on zoom-in or zoom-out performs the action and immediately submits the form the map is in :(

The workaround is to simply add type="button", which is a best practice nowadays (see html - What is the default button type? - Stack Overflow)

Thanks

mariusandra commented 1 year ago

Hey! Fixed in 0.21.1