oficina / mapa Public

New team page is a popover; rail tooltips escape the sidebar

The sidebar scrolls, so the absolutely placed form and tooltips were
clipped by it. The form is a native popover (top layer, platform Esc,
light dismiss and focus), anchored to its button where supported and
fixed beside the sidebar's foot elsewhere. Tooltips are position:
fixed, anchored to their row where supported.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev e7edf4fd5d5564894844839ea8acef04d37a5401 parent af14dc0
3 files changed, +98 −30
  • internal/mapa/static/frame.css +77 −21
  • internal/mapa/templates/frame.html +20 −9
  • internal/mapa/templates/shell.html +1 −0
diff --git a/internal/mapa/static/frame.css b/internal/mapa/static/frame.css
index c106f6a..9915dac 100644
--- a/internal/mapa/static/frame.css
+++ b/internal/mapa/static/frame.css
@@ -129,7 +129,10 @@ kbd[mapa-kbd] {
}
/* ── The rail (Página's): the same rows, icons only, on one axis. The
- label stays in the accessibility tree and is the tooltip. ── */
+ label stays in the accessibility tree and is the tooltip. The tooltip
+ is fixed where its row puts it (its static position, insets left
+ auto), then moved out beside the 40px row: a fixed box escapes the
+ sidebar's scrolling, which clipped an absolute one. ── */
@media (min-width: 800px) {
[mapa-app][data-side="rail"] [mapa-side] { padding-inline: 8px; align-items: center; }
[mapa-app][data-side="rail"] [mapa-side-item] {
@@ -156,8 +159,10 @@ kbd[mapa-kbd] {
background: var(--rst-accent);
}
[mapa-app][data-side="rail"] [mapa-side-label] {
- position: absolute;
- inset-inline-start: calc(100% + 10px);
+ position: fixed;
+ margin-inline-start: 50px;
+ margin-block-start: 19px;
+ translate: 0 -50%;
z-index: 30;
padding: 4px 8px;
border-radius: 6px;
@@ -201,8 +206,10 @@ kbd[mapa-kbd] {
background: var(--rst-accent);
}
[mapa-app]:not([data-side]) [mapa-side-label] {
- position: absolute;
- inset-inline-start: calc(100% + 10px);
+ position: fixed;
+ margin-inline-start: 50px;
+ margin-block-start: 19px;
+ translate: 0 -50%;
z-index: 30;
padding: 4px 8px;
border-radius: 6px;
@@ -373,31 +380,80 @@ textarea[mapa-editor]:focus { outline: none; box-shadow: none; }
[mapa-unsaved] p { margin: 0; flex: 1 1 16rem; }
-/* New team page: a popover from the sidebar's foot (§4.7). */
-details[mapa-new-page] { position: relative; }
-details[mapa-new-page] > summary { list-style: none; }
-details[mapa-new-page] > summary::-webkit-details-marker { display: none; }
-form[mapa-new-page-form] {
- position: absolute;
- z-index: 40;
- inset-block-end: calc(100% + 6px);
- inset-inline-start: 0;
- display: grid;
- gap: 8px;
- inline-size: 260px;
+/* New team page (§4.7): a popover in the top layer, so the sidebar's
+ overflow never clips it, whatever its state. Anchored to its button
+ where the engine anchors: above it in the open sidebar, beside it on
+ the rail. Elsewhere it sits fixed beside the sidebar's foot. */
+[mapa-new-page-link] { display: none; }
+@supports not selector(:popover-open) {
+ [mapa-new-page-open], [mapa-new-page] { display: none; }
+ [mapa-new-page-link] { display: grid; }
+}
+[mapa-new-page-open] { anchor-name: --mapa-new-page; }
+[mapa-new-page] {
+ box-sizing: border-box;
+ inline-size: min(286px, calc(100vw - 16px));
+ margin: 0;
+ inset: auto;
+ inset-block-end: 12px;
+ inset-inline-start: calc(var(--mapa-side-w) + 10px);
padding: 12px;
+ overflow: visible;
border: 1px solid var(--rst-line);
border-radius: 12px;
background: var(--rst-surface);
+ color: var(--rst-text);
box-shadow: 0 18px 40px -16px rgb(23 32 60 / 0.35);
+ font-size: 13px;
}
+form[mapa-new-page-form] { display: grid; gap: 8px; margin: 0; }
form[mapa-new-page-form] label { font-size: 12px; font-weight: 650; color: var(--rst-text-muted); }
form[mapa-new-page-form] p { margin: 0; font-size: 12px; }
-@media (min-width: 800px) {
- [mapa-app][data-side="rail"] form[mapa-new-page-form] { inset-block-end: 0; inset-inline-start: calc(100% + 10px); }
+[mapa-new-page-error][hidden] { display: none; }
+[mapa-new-page-error] a { color: inherit; }
+@supports (anchor-name: --mapa-new-page) {
+ [mapa-new-page] {
+ position-anchor: --mapa-new-page;
+ inset-block-end: calc(anchor(start) + 6px);
+ inset-inline-start: anchor(start);
+ position-try-fallbacks: flip-block;
+ }
+ @media (min-width: 800px) {
+ [mapa-app][data-side="rail"] [mapa-new-page] {
+ inset-block-end: anchor(end);
+ inset-inline-start: calc(anchor(end) + 10px);
+ }
+ }
+ @media (min-width: 800px) and (max-width: 79.99rem) {
+ [mapa-app]:not([data-side]) [mapa-new-page] {
+ inset-block-end: anchor(end);
+ inset-inline-start: calc(anchor(end) + 10px);
+ }
+ }
}
-@media (min-width: 800px) and (max-width: 79.99rem) {
- [mapa-app]:not([data-side]) form[mapa-new-page-form] { inset-block-end: 0; inset-inline-start: calc(100% + 10px); }
+
+/* Where the engine anchors, each tooltip is tied to its own row
+ (anchor-scope keeps the name to that row), so it follows the rail as
+ it scrolls; a static position is fixed where layout put it. */
+@supports (anchor-name: --mapa-side-item) {
+ @media (min-width: 800px) {
+ [mapa-side-item] { anchor-name: --mapa-side-item; anchor-scope: --mapa-side-item; }
+ [mapa-new-page-open] { anchor-name: --mapa-new-page, --mapa-side-item; }
+ [mapa-app][data-side="rail"] [mapa-side-label] {
+ position-anchor: --mapa-side-item;
+ inset-block-start: anchor(center);
+ inset-inline-start: calc(anchor(end) + 10px);
+ margin: 0;
+ }
+ }
+ @media (min-width: 800px) and (max-width: 79.99rem) {
+ [mapa-app]:not([data-side]) [mapa-side-label] {
+ position-anchor: --mapa-side-item;
+ inset-block-start: anchor(center);
+ inset-inline-start: calc(anchor(end) + 10px);
+ margin: 0;
+ }
+ }
}
/* Below 800px there is no sidebar: its places are rows in estilo's
diff --git a/internal/mapa/templates/frame.html b/internal/mapa/templates/frame.html
index cfa281f..8507aa0 100644
--- a/internal/mapa/templates/frame.html
+++ b/internal/mapa/templates/frame.html
@@ -133,15 +133,10 @@
{{- range .}}{{template "mapa-side-link" .}}{{end}}
{{- end}}
<div mapa-side-foot>
- <details mapa-new-page name="estilo-menus">
- <summary mapa-side-item>{{icon "plus"}}<span mapa-side-label>New team page</span></summary>
- <form method="post" action="/pages" mapa-new-page-form>
- <label for="mapa-new-title">Title of the new team page</label>
- <input rst-input id="mapa-new-title" name="title" required maxlength="120" autocomplete="off">
- <p mapa-meta>Everyone in the team can open it.</p>
- <button rst-btn="primary" type="submit">Create page</button>
- </form>
- </details>
+ {{- /* New team page (§4.7) opens mapa-new-page, a popover. The link
+ is for an engine without popovers (frame.css shows it there). */}}
+ <button mapa-side-item type="button" popovertarget="mapa-new-page" mapa-new-page-open>{{icon "plus"}}<span mapa-side-label>New team page</span></button>
+ <a mapa-side-item href="/new" mapa-new-page-link>{{icon "plus"}}<span mapa-side-label>New team page</span></a>
<form method="post" action="/view/sidebar" mapa-fold>
<input type="hidden" name="return" value="{{.Return}}">
<button mapa-side-item type="submit" name="state" value="rail" mapa-fold-to="rail" data-mapa-command="toggle-sidebar">{{icon "panel-left"}}<span mapa-side-label>Fold sidebar</span><kbd mapa-kbd aria-hidden="true">⌘\</kbd></button>
@@ -151,6 +146,22 @@
</nav>{{end}}
{{define "mapa-side-link"}}<a mapa-side-item mapa-side-page href="{{.Href}}"{{if .Current}} aria-current="page"{{end}}>{{icon .Icon}}<span mapa-side-label>{{.Label}}</span></a>{{end}}
+{{/* mapa-new-page: New team page's popover (§4.7), opened by the
+ sidebar's button. In the top layer, so the sidebar's scrolling never
+ clips it, and the platform's own Esc, click outside and focus, with
+ no script. Drawn after <main>: WebKit gives the page's autofocus to
+ the first [autofocus] in the document, even a hidden one, so this
+ field must come after a screen's own. */}}
+{{define "mapa-new-page"}}<div popover id="mapa-new-page" mapa-new-page role="dialog" aria-label="New team page">
+ <form method="post" action="/pages" mapa-new-page-form>
+ <label for="mapa-new-title">Title of the new team page</label>
+ <input rst-input id="mapa-new-title" name="title" required maxlength="120" autocomplete="off" autofocus aria-describedby="mapa-new-page-said">
+ <p rst-field-error mapa-new-page-error id="mapa-new-page-error" role="alert" hidden></p>
+ <p mapa-meta id="mapa-new-page-said">Everyone in the team can open it.</p>
+ <button rst-btn="primary" type="submit">Create page</button>
+ </form>
+</div>{{end}}
+
{{/* mapa-keys: Help → Keyboard shortcuts. A <dialog> estilo's invoker
command opens, with no script. */}}
{{define "mapa-keys"}}<dialog id="mapa-keys" mapa-dialog aria-labelledby="mapa-keys-title">
diff --git a/internal/mapa/templates/shell.html b/internal/mapa/templates/shell.html
index 9bfe97e..e3ccd36 100644
--- a/internal/mapa/templates/shell.html
+++ b/internal/mapa/templates/shell.html
@@ -41,6 +41,7 @@
{{template "content" .}}
</div>
</main>
+{{template "mapa-new-page"}}
{{with .Frame.History}}{{template "mapa-history" .}}{{end}}
</div>
{{template "mapa-keys"}}