Skip to content

Fix MapLibre layer manager slider width and style panel spacing - #1415

Merged
giswqs merged 3 commits into
masterfrom
fix/maplibre-opacity-slider-width
Nov 12, 2026
Merged

giswqs merged 3 commits into
masterfrom
fix/maplibre-opacity-slider-width

Conversation

@giswqs

@giswqs giswqs commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The opacity slider in the MapLibre layer manager was squeezed to its 40px minimum because the layer name checkbox used an auto flex basis with a default 300px width. The checkbox now uses a zero flex basis so it only fills leftover space, and the slider has a fixed 90px width.
  • The layer style panel added its own 10px padding inside the already padded sidebar panel, and its empty output area added margins, leaving a large gap below the Apply/Reset/Close buttons. Both are removed.

Test plan

  • Opened the layer manager in JupyterLab: the opacity slider keeps its full width
  • Long layer names still truncate with an ellipsis without pushing the buttons out of the row
  • Opened the style panel for a layer: no extra space below the buttons
  • pre-commit run --all-files passes

Summary by CodeRabbit

  • Style
    • Improved layer controls layout: layer names remain flexible, opacity sliders retain a usable width, and extra spacing around the style output has been reduced.

The layer name checkbox used an auto flex basis, so its default 300px width
squeezed the opacity slider down to its 40px minimum. Give the checkbox a zero
flex basis and the slider a fixed 120px width.
Copilot AI balanced review requested due to automatic review settings November 12, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The MapLibre layer controls update flex sizing for the layer-name checkbox and opacity slider. The layer-style widget output margin and layout padding are set to zero.

Changes: MapLibre widget layout

Layer / File(s) Summary
Layer-row control sizing
leafmap/maplibregl.py
The checkbox flex basis changes from auto to 0. The opacity slider no longer shrinks, and its minimum width changes from 40px to 90px. Its width remains 90px.
Layer-style widget spacing
leafmap/maplibregl.py
The output widget margin changes to zero. The layout padding changes from 10px to 0, while its width remains 300px.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to 22c72

This PR adjusts the layer manager's slider and checkbox widths and removes extra spacing below the style panel buttons. It is a layout-only change and I found no functional risk. It looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two areas the diff changes: the MapLibre layer manager slider width and the style panel spacing. The raw summary confirms the opacity slider minimum width change in LayerManagerWid…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two areas the diff changes: the MapLibre layer manager slider width and the style panel spacing. The raw summary confirms the opacity slider minimum width change in LayerManagerWidget.build_layer_controls and the zero margin and padding changes in LayerStyleWidget.init. The title is specific and matches the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the layer row,
The checkbox flexes; sliders stay.
The style widget sheds its space,
Zero margin, padding gone.
I hop along the map controls,
And nibble clover on my way.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 130c6077-256a-402f-94c0-3e98869eaf32
Commits

Reviewing files that changed from the base of the PR and between 2764bfe and 22c72f0.

Files selected for processing: 1

  • leafmap/maplibregl.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Comment thread leafmap/maplibregl.py
flex="0 0 auto",
width="90px",
min_width="40px",
min_width="90px",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low-confidence concern: the slider is now rigid (flex="0 0 auto", min_width="120px"). The checkbox can shrink to 0 (flex 1 1 0, min_width=0), but the slider can't. In a panel narrower than roughly 120px plus the buttons and padding, the row would overflow and could push the buttons out. The test only covered a 340px panel. A shrinkable slider would keep the old safety valve, for example flex="0 1 120px" with a smaller min_width such as 60px. The checkbox's zero basis already fixes the original squeeze, so this would keep the fix and still let narrow panels degrade gracefully.

Suggested change
min_width="90px",
flex="0 1 120px",
width="120px",
min_width="60px",

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Code review

The PR is a small layout tweak in build_layer_controls (leafmap/maplibregl.py). It sets the layer-name checkbox to flex: 1 1 0 and the opacity slider to a fixed 90px (flex: 0 0 auto, min_width: 90px). I only read the diff and did not run it in a notebook.

Bugs

  • None found.

Security

  • None. The change is layout-only and touches no input handling.

Performance

  • None.

Quality

  • Narrow panels (low confidence, about 30%). The slider can no longer shrink (min_width went from 40px to 90px). The checkbox can also shrink to 0 (min_width: 0, overflow: hidden). In a very narrow layer-manager panel, long layer names will be clipped to nothing before the slider gives up any space. If that matters, a smaller min_width on the slider, such as 60px, would keep some flexibility. This is a design tradeoff and matches the intent of the previous commit, "Reduce layer manager opacity slider width to 90px".
  • Redundant sizing (nit). flex="0 0 auto" together with width="90px" and min_width="90px" pins the size three ways. flex="0 0 90px" plus width="90px" would be enough. This is cosmetic.

CLAUDE.md

  • No CLAUDE.md guidelines were violated by this change.

@github-actions
github-actions Bot temporarily deployed to pull request November 12, 2026 20:29 Inactive
The style widget added its own 10px padding inside the already padded sidebar
panel, and the empty output area added margins, leaving a gap below the
buttons. Drop both.
@giswqs giswqs changed the title Widen opacity slider in MapLibre layer manager Fix MapLibre layer manager slider width and style panel spacing Nov 12, 2026
Comment thread leafmap/maplibregl.py
tooltip="Change layer opacity",
layout=widgets.Layout(
flex="0 1 90px",
flex="0 0 auto",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low confidence: the slider is now rigid (flex: 0 0 auto, min_width: 90px), and the checkbox has min_width=0 and overflow=hidden with a zero basis. In a narrow sidebar, or with long layer names, the checkbox label shrinks to nothing and gets clipped, and the slider never gives up space. Before this change the slider could shrink to 40px. Consider keeping a small shrink allowance, for example flex="0 1 90px" with min_width="60px". Alternatively, give the checkbox a modest min_width so labels stay readable.

@github-actions

Copy link
Copy Markdown

Code review

This PR is a small UI layout fix in leafmap/maplibregl.py. It changes the flex settings of the layer-control checkbox and opacity slider. It also removes the padding and margin below the MapLibre style editor buttons. I found no bugs, security issues or performance problems, and the diff doesn't touch anything outside layout code.

Bugs

  • None found.

Security

  • None found.

Performance

  • None found.

Quality

  • Rigid slider width (low confidence): the opacity slider is now fixed at 90px (flex: 0 0 auto, min_width: 90px). The checkbox has a zero flex basis, min_width=0 and overflow=hidden. In a narrow sidebar or with long layer names, the layer name could be clipped to almost nothing, because the slider no longer gives up any space. Keeping a small shrink allowance on the slider, such as 0 1 90px with a lower min_width, would avoid this. I posted this as an inline comment.
  • The comments added to explain the layout changes are clear.

CLAUDE.md

  • No CLAUDE.md guidelines were applicable to the changed lines.

I only read the diff and haven't rendered the UI. The visual outcome, including the slider squeeze concern above, is worth a quick manual check in a notebook sidebar.

@github-actions
github-actions Bot temporarily deployed to pull request November 12, 2026 20:32 Inactive
@giswqs
giswqs merged commit a4eda8c into master Nov 12, 2026
20 checks passed
@giswqs
giswqs deleted the fix/maplibre-opacity-slider-width branch November 12, 2026 20:35

This branch was previously deployed

1 inactive deployment
pull request — 22c72f0e Deployed Nov 12, 2026 by github-actions[bot]
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.

2 participants