fix(ui): terrain-popup закрывается при открытии bottom-sheet (ET-014)
All checks were successful
CI / lint (push) Successful in 4s
CI / test (push) Successful in 10s
CI / build (push) Successful in 3s
CI / lint (pull_request) Successful in 4s
CI / test (pull_request) Successful in 9s
CI / build (pull_request) Successful in 2s

При открытии любого .bottom-sheet через openSheet() теперь принудительно
скрывается #terrain-popup и снимается .active с #terrain-toggle. Это
устраняет z-index конфликт (popup z=500 над sheet z=400) и убирает
anti-pattern «два меню одновременно» на desktop без правки CSS-стека
(marker-dialog z=500, search-panel, ruler-info — без регрессий).

Реализация — Вариант A из ADR-019: helper closeTerrainPopup() + один
вызов первой строкой в openSheet() после null-check. Для других sheets
(sheet-route, sheet-recon, sheet-scenic, sheet-link, sheet-gpx) вызов
безопасный no-op, REQ-F-06 выполняется автоматически.

Тесты:
- tests/unit/sheet_popup.test.js — 8 behavioral JS unit-тестов
  (TC-U-02, REQ-F-04, REQ-F-06 + ребра closeTerrainPopup).
- tests/unit/test_sheet_popup.py — pytest-обёртка: статические проверки
  app.js (порядок вызовов в openSheet, маркеры блока), охранные тесты
  что z-stack не тронут и что gps_tracks.js/index.html не правились.

Refs: ET-014
ADR: docs/work-items/ET-014/06-adr/ADR-019-terrain-popup-yields-to-sheet.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-04 11:20:49 +00:00
parent bc63122221
commit 39348f6781
3 changed files with 471 additions and 0 deletions

View File

@@ -203,9 +203,25 @@ function formatDist(m) {
// ─── Sheet Management ──────────────────────────────────────────────
// >>> ET-014 sheet-popup yield block (см. ADR-019)
// При открытии любого bottom-sheet'а принудительно закрываем
// #terrain-popup. Это устраняет z-index конфликт (popup z=500 над
// sheet z=400) и убирает anti-pattern «два меню открыты одновременно»
// на desktop. См. docs/work-items/ET-014/06-adr/ADR-019-*.
function closeTerrainPopup() {
const popup = document.getElementById('terrain-popup');
const btn = document.getElementById('terrain-toggle');
if (!popup || popup.style.display === 'none') return;
popup.style.display = 'none';
if (btn) btn.classList.remove('active');
document.removeEventListener('click', closeTerrainOnOutside);
}
function openSheet(id) {
const sheet = document.getElementById(id);
if (!sheet) return;
// ET-014: terrain-popup yields to any opening sheet (ADR-019).
closeTerrainPopup();
// Close all other sheets first
document.querySelectorAll('.bottom-sheet.open').forEach(s => {
if (s.id !== id) closeSheet(s.id);
@@ -214,6 +230,7 @@ function openSheet(id) {
const backdrop = document.getElementById('sheet-backdrop');
backdrop.classList.add('visible');
}
// <<< ET-014 sheet-popup yield block <<<
function closeSheet(id) {
const sheet = document.getElementById(id);