Repository navigation
Apply zIndex and opacity consistently on image, video and SVG overlays - #10533
Merged
Merged
Conversation
VideoOverlay and SVGOverlay override _initImage, which was the only place that applied options.zIndex on add, so they ignored the option as well as a setZIndex call made before adding them, which is what LayersControl's autoZIndex does. ImageOverlay skipped a zIndex of 0, and setStyle ignored an opacity of 0.
mourner
approved these changes
Nov 6, 2026
simon04
pushed a commit
to maplair/maplair
that referenced
this pull request
Nov 8, 2026
The zIndex option was applied only to images created by the overlay and only if not 0, and a z-index set before adding the overlay was lost for supplied elements. setStyle() now also applies an opacity of 0. The specs of the video overlay use data URIs instead of fetching videos. Leaflet: Leaflet/Leaflet#10533 Leaflet commits: Leaflet/Leaflet@e69418f, Leaflet/Leaflet@339c6b1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VideoOverlayandSVGOverlayoverride_initImage, which was the only place that appliedoptions.zIndexwhen an overlay is added. So they ignore the option, and also asetZIndexcall made before adding them, which is whatLayersControl'sautoZIndexdoes.Two more cases of a 0 being ignored:
new ImageOverlay(url, bounds, {zIndex: 0})sets no z-indexoverlay.setStyle({opacity: 0})does nothing, sofeatureGroup.setStyle({opacity: 0})hides the paths and leaves the overlays visiblezIndexis now applied inonAdd, for all three classes.One thing to check: the
zIndex: 1default now also reaches video and SVG overlays, so they stack above vector layers in the overlay pane, as image overlays already do.