Skip to content

Restyle the map controls on the theme's design tokens - #317

Merged
sandesh-sp merged 3 commits into
developmentfrom
fix/map-controls-styling
Aug 13, 2026
Merged

Restyle the map controls on the theme's design tokens#317
sandesh-sp merged 3 commits into
developmentfrom
fix/map-controls-styling

Conversation

@sandesh-sp

Copy link
Copy Markdown
Collaborator

The map control bar drew its own look from literals that had drifted from the theme — a teal primary (#0e7482) no theme emits, ad-hoc drop shadows, and rounded surfaces. Every value now resolves against the --theme-* custom properties exported from src/styles/_theme-export.scss, with the horizon palette as the fallback for when no theme bundle is loaded.

What changed

Design tokens. Colors, spacing, radii, border widths and type all come from --theme-*. Surfaces are square (--theme-radius-0, stated rather than left to the initial value, since Safari rounds type=search) and carry no borders or shadows — they separate by ground alone.

One interaction palette across bar buttons, panel rows and menu items:

State Treatment
Default --theme-color-base-darker icons, --theme-color-base text
Hover --theme-color-primary on --theme-color-primary-lightest
Open / selected --theme-color-primary fill, --theme-color-white

Each active rule is written &--active, &--active:hover — same specificity as the hover rule, so without the second selector hovering an already-open control would knock it back.

Geometry. Buttons are 36×36 with 16×16 glyphs, spaced --theme-spacing-05 apart.

Icons. Basemap, search, zoom in and zoom out use the provided artwork, inlined as paths drawn in currentColor so the button's color token reaches them through every state. Measure keeps its existing glyph — the icon set has no ruler.

Panels are portaled. FloatingPopover joins MapControl's lib/ (its own copy, as in Timeline and LayerManager — the lib/ boundary forbids cross-plugin imports) and now hosts the basemap and search panels. They render at <body>, clearing the overflow: hidden on .ui-float-panel .ui-tool-card that clipped them, and the component owns outside-click, Escape, focus placement and focus restoration to the trigger. That retires useOutsideClick and SearchPanel's own autofocus effect; the bar's Escape handler now only exits measure mode.

Accessibility. Triggers carry aria-controls; panels get role="dialog" and labels. Focus rings are restored on every control, since core's global *:focus { outline: none } strips them. The search field, now borderless, shows focus as an outline and marks itself with a filled ground.

The measure prompt ("Click two points on the map") is removed.

Beyond MapControl

_shared/share/share-menu.scss follows the same direction: its --se-* tokens resolve through --mmgis-* override → --theme-* token → literal, and the menu is a plain list of full-width rows rather than inset pills, matching the basemap panel. This changes ShareExport too, which hosts the same control — its trigger and dropdown lose their teal accent, rounding and shadow.

Verification

npx tsc --noEmit clean · both stylesheets compile under sass · npx vitest run 1287/1287 passing.

Not verified in a running instance — none of this is covered by tests, so the bar, both dropdowns and the share menu are worth a look on screen before merge.

The map control bar drew its own look from literals that had drifted
from the theme: a teal primary no theme emits, ad-hoc shadows, and
rounded surfaces. Every value now resolves against the exported
--theme-* custom properties, with the horizon palette as the fallback
for when no theme bundle is loaded.

The surfaces are square and unshadowed, separated by ground alone, and
the controls share one interaction palette: base-darker icons, primary
on primary-lightest for hover, and a primary fill with white for the
open or selected state. Buttons are 36x36 with 16px glyphs, spaced a
quarter-unit apart.

The basemap and search panels move into FloatingPopover, portaled to
<body> so they clear the tool card's clipped overflow, with the
component handling outside-click, Escape, and focus placement and
restoration. The measure prompt that sat under the bar is gone.

The shared share control follows: its tokens resolve through the
--theme-* layer, and its menu is a plain list of full-width rows rather
than inset pills, matching the basemap panel. This changes ShareExport,
which hosts the same control.
The bar right-aligns its contents, but the element it mounts into sized
itself to them: a floating panel lays its tool card out as a flex row, so
the host shrink-wrapped the bar and left the alignment nothing to work
against. The host claims the card's full width instead, and the bar spans
it.

@BhattaraiSijan BhattaraiSijan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ran tsc --noEmit (clean), both stylesheets under sass (clean), and vitest (1287/1287) on the branch. No bugs found — a few small inline fixes below. The larger items (FloatingPopover now being a third copy that diverges via an unused role prop — likely a move to _shared/ — plus gating the search popover on onSearchSelect like its trigger, and the on-screen check of the now borderless/shadowless surfaces) are deferred to follow-up issues.

Comment thread src/essence/Tools/MapControl/lib/geo/MapControlBar/MapControlBar.tsx Outdated
Comment thread src/essence/Tools/MapControl/lib/hooks/useMeasure.ts
Comment thread src/essence/Tools/_shared/share/share-menu.scss Outdated
Co-authored-by: Sijan Bhattarai <BhattaraiSijan@outlook.com>
@sandesh-sp
sandesh-sp merged commit acbcda7 into development Aug 13, 2026
4 checks passed
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