Skip to content

Don't overwrite Control's args when checking position - #2336

Open
NotAFlightRisk wants to merge 1 commit into
python-visualization:mainfrom
NotAFlightRisk:fix-control-position-args
Open

NotAFlightRisk wants to merge 1 commit into
python-visualization:mainfrom
NotAFlightRisk:fix-control-position-args

Conversation

@NotAFlightRisk

Copy link
Copy Markdown

If you pass position to Control it's ignored, and so is every other option. Control("Zoom", position="bottomright") renders new L.Control.Zoom("bottomright", "bottomleft", "topright", "topleft", {"position": "bottomright"}), Leaflet takes the first string as its options, and the buttons stay top-left. Any real positional args (a MiniMap's layer, say) get lost too.

The walrus in the position check assigns to args, which is also the *args parameter, so renaming it is all it needed. The new test passes a real position, since the existing one only tries a bad one. I checked it before and after in Chromium against 0.20.0.

The position check assigned get_args(TypePosition) to args, which is also
the name of the *args parameter, so self.args became the four corner names.
Leaflet then read the first corner name as the options object and ignored
position and every other option.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant