oficina / estilo Public

chrome: 32px menubar hit areas on a coarse pointer, from 800px

Fable's P3.5 on estilo #34. From 800px the stacked header's menubar
titles are 24px tall, which a coarse pointer finds small. Under
pointer: coarse each title is position: relative with an empty ::before
4px over each edge, so it takes 32px of hit area with no change to
layout or paint. That band reaches up under the title field's foot, so
the title form sits on top (z-index: 1) and keeps all of its own 24px.

Hit-tested with elementFromPoint in Chromium (isMobile, hasTouch) and
WebKit (hasTouch), coarse matched in both, at 1280px: Help 24-56 (32px,
was 28-52), File under the title field 32-56 (24px, was 28-52), the
title field 8-32 (all 24px; with the ::before alone it lost 8px of it).
The header stays 56px.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev ee41d1d0adb16e7c94736252a3eb9dabbe9519ec parent 8b87842
2 files changed, +23 −1
  • chrome/chrome.css +9 −1
  • chrome/stack_test.go +14 −0
diff --git a/chrome/chrome.css b/chrome/chrome.css
index 557e881..003baaf 100644
--- a/chrome/chrome.css
+++ b/chrome/chrome.css
@@ -591,11 +591,19 @@
background-position: right center;
}
- /* Coarse pointers: the header's controls rise to 32px. */
+ /* Coarse pointers: the header's controls rise to 32px, and the menubar
+ titles keep their 24px look in the 20px row but take 32px of hit
+ area, 4px over each edge, drawn by nothing and taking no room. Where
+ that reaches up under the title field, the field stays on top
+ (z-index): it keeps all of its own 24px, and a menu under it keeps
+ 24px from the field's foot to the header's edge. */
@media (pointer: coarse) {
:is([estilo-bar-control] > a, [estilo-bar-control] > button, [estilo-bar-control] > form > button) { block-size: 32px; min-block-size: 32px; }
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] > [estilo-bar-trigger],
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-account] [estilo-avatar] { inline-size: 32px; block-size: 32px; }
+ [estilo-bar~="stacked"] [estilo-menubar-title] { position: relative; }
+ [estilo-bar~="stacked"] [estilo-menubar-title]::before { content: ""; position: absolute; inset-inline: 0; inset-block: -4px; }
+ [estilo-bar~="stacked"] [estilo-bar-title] { z-index: 1; }
}
}
@media (min-width: 64rem) {
diff --git a/chrome/stack_test.go b/chrome/stack_test.go
index 0325533..8c26921 100644
--- a/chrome/stack_test.go
+++ b/chrome/stack_test.go
@@ -302,6 +302,20 @@ func TestTheStackedBarPublishesItsHeight(t *testing.T) {
t.Errorf("chrome.css lacks %s", re)
}
}
+ // Coarse pointers: the menubar titles keep their 24px look but take
+ // 32px of hit area, 4px over each edge, with no change to layout.
+ coarse := src[strings.Index(src, "@media (min-width: 800px) {"):]
+ coarse = coarse[strings.Index(coarse, "@media (pointer: coarse) {"):]
+ coarse = coarse[:strings.Index(coarse, "\n }\n")]
+ for _, want := range []string{
+ `[estilo-bar~="stacked"] [estilo-menubar-title] { position: relative; }`,
+ `[estilo-bar~="stacked"] [estilo-menubar-title]::before { content: ""; position: absolute; inset-inline: 0; inset-block: -4px; }`,
+ `[estilo-bar~="stacked"] [estilo-bar-title] { z-index: 1; }`, // the title field keeps its own 24px on top
+ } {
+ if !strings.Contains(coarse, want) {
+ t.Errorf("the coarse-pointer rules lack %s", want)
+ }
+ }
// Coarse pointers raise the controls to 32px.
if !regexp.MustCompile(`@media \(pointer: coarse\) \{\s*:is\(\[estilo-bar-control\] > a, [^)]*\) \{ block-size: 32px; min-block-size: 32px; \}`).MatchString(src) {
t.Error("the controls do not rise to 32px on a coarse pointer")