The second beta of Leaflet 2.0 adds a built-in fullscreen control, a way to translate the built-in text, and canvas layers that no longer block clicks on the layers below them, along with over a dozen bug fixes.
Plugin authors: if your plugin works with Leaflet 2.0, set compatible-v2: true in its entry in docs/_plugins to list it under "Ready for Leaflet 2" on the plugins page. See the migration guide for what changed for plugins, and Leaflet.markercluster and Leaflet.heat for examples of plugins ported to support both 1.9 and 2.0.
❇️ New features
- Add
FullscreenControl, an opt-in control that makes the map fullscreen, replacing theleaflet.fullscreenplugins. It adds 0.5 kB gzipped only when imported, and falls back to filling the window on iPhone (#10531) - Add a
translatemap option to translate the built-in text, such as control titles and accessible labels:translate: text => i18next.t(text). Plugins can callmap.translate(text)so their text gets translated the same way (#10534, #9092) - Add
originalEventtomovestart,move,moveend,zoomstart,zoomandzoomendwhen the user changes the view, so listeners can tell user moves from programmatic ones (#10525) - Add a
titleoption toLayersControl
✨ Improvements
- Make canvas renderers transparent to pointer events, so SVG paths, markers, overlays and other canvas renderers below them get clicks and hovers (#10523, #3888, #4135, #5739, #5886, #6205, #7049)
- Stop throttling hover events on canvas paths, so they respond as quickly as SVG paths (#9514)
- Draw the zoom control's + and − as SVG, so they're crisp and centered with any font
♿️ Accessibility
- Raise markers with
riseOnHoveron keyboard focus too (#8078) - Fix Enter and Space on a focused marker doing nothing after a drag (#10529 by @Enfiladeguide)
- Fix Escape being ignored by the map after closing a popup
- Set
aria-describedbyon a layer whenever its tooltip opens, however it was opened
🐞 Bug fixes
- Fix paths jumping when they're changed or added during a zoom animation or pinch (#9373)
- Fix
setViewand other view changes being ignored during a zoom animation, they now apply once it ends (#10407 by @yellowman, #1289) - Fix
minNativeZoomandmaxNativeZoomrequesting the wrong zoom level withdetectRetinaon retina screens (#10111, #8850) - Fix
closestLayerPointon polygons ignoring the segment that closes the ring (#9098, #9114) - Fix a second click on an image, video or SVG overlay closing its popup instead of moving it, as on paths (#7849)
- Fix
zIndexandsetZIndex()being ignored on video and SVG overlays, andzIndex: 0andopacity: 0being ignored on all image overlays (#10533 by @b84330808) - Fix
setContent('')leaving the old content in a popup or tooltip (#10532 by @Don-Yin) - Fix markers losing their altitude after a drag (#9694, #9689)
- Fix a double tap firing
dblclickthree times on iOS with a canvas renderer (#10524) - Fix a click firing after a long-press
contextmenuon iOS - Fix gaps in the API docs (#7213, #7936)
⚠️ Breaking changes
- The
<canvas>element of a canvas renderer no longer receives pointer events, so DOM listeners added to it don't fire; listen on the layers or the map instead. The privateCanvasmethods_onClick,_onPointerMove,_handlePointerHover,_handlePointerOutand_fireEventare gone; the map calls_layerAt()to find the path under the pointer (#10523) DomEvent.on(el, 'dblclick', ...)no longer simulates double taps on iOS for elements outside a map (#10524)- With
detectRetina,minNativeZoomandmaxNativeZoomare now adjusted likemaxZoom. If you added 1 to them to work around #10111, remove it