Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/map-template/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.96.20] - 2026-03-27

### Fixed

- An issue when expanded Floor Selector would overlap Zoom Controls and Full Screen butto.

## [1.96.19] - 2026-03-26

### Fixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef, useCallback, useMemo, memo } from 'react';
import { useEffect, useRef, useState, useCallback, useMemo, memo } from 'react';
import PropTypes from 'prop-types';
import './MapControls.scss';
import { useIsDesktop } from '../../../hooks/useIsDesktop';
Expand Down Expand Up @@ -60,6 +60,9 @@ function MapControls({ mapType, mapsIndoorsInstance, mapInstance, onPositionCont
const isDesktop = useIsDesktop();
const floorSelectorRef = useRef(null);
const positionButtonRef = useRef(null);
const bottomControlsRef = useRef(null);
const overlapTimerRef = useRef(null);
const [isFloorSelectorExpanded, setIsFloorSelectorExpanded] = useState(false);

// Helper function to check if an element should be rendered
const shouldRenderElement = useCallback((elementName) => {
Expand Down Expand Up @@ -210,6 +213,58 @@ function MapControls({ mapType, mapsIndoorsInstance, mapInstance, onPositionCont
});
}, [excludedElements, shouldRenderElement, isDesktop]);

// Observe the floor selector's toggle button class to detect expansion,
// then check whether it actually overlaps the bottom controls before hiding them.
useEffect(() => {
const floorSelector = floorSelectorRef.current;
if (!floorSelector) return;

const checkOverlap = () => {
if (overlapTimerRef.current) {
clearTimeout(overlapTimerRef.current);
}

const button = floorSelector.querySelector('.mi-floor-selector__button');
if (!button) return;

const isOpen = button.classList.contains('mi-floor-selector__button--open');

if (!isOpen) {
setIsFloorSelectorExpanded(false);
return;
}

// Wait for the list expansion animation (50ms) to finish before measuring
overlapTimerRef.current = setTimeout(() => {
const bottomControls = bottomControlsRef.current;
if (!bottomControls) {
setIsFloorSelectorExpanded(false);
return;
}

const selectorEl = floorSelector.querySelector('.mi-floor-selector') || floorSelector;
const selectorRect = selectorEl.getBoundingClientRect();
const controlsRect = bottomControls.getBoundingClientRect();

setIsFloorSelectorExpanded(selectorRect.bottom > controlsRect.top);
}, 50);
};

const observer = new MutationObserver(checkOverlap);
observer.observe(floorSelector, {
subtree: true,
attributes: true,
attributeFilter: ['class']
});

return () => {
observer.disconnect();
if (overlapTimerRef.current) {
clearTimeout(overlapTimerRef.current);
}
};
}, [mapsIndoorsInstance, mapInstance]);

if (isKiosk) {
if (enableAccessibilityKioskControls) {
return (
Expand Down Expand Up @@ -274,7 +329,7 @@ function MapControls({ mapType, mapsIndoorsInstance, mapInstance, onPositionCont
</div>

{/* Bottom right desktop controls */}
<div className="map-controls-container desktop bottom-right">
<div ref={bottomControlsRef} className={`map-controls-container desktop bottom-right ${isFloorSelectorExpanded ? 'map-controls-container--floor-selector-open' : ''}`}>
{shouldRenderElement('zoomControls') && (
<MapZoomControl mapType={mapType} mapInstance={mapInstance} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
right: calc(1 * var(--spacing-medium));
}

// Hide bottom controls when the floor selector is expanded to prevent occlusion
.map-controls-container--floor-selector-open {
visibility: hidden;
pointer-events: none;
}

// Mobile layout, two columns aligned to the top left and right
.mobile-column {
@extend %control-container;
Expand Down