oficina / estilo Public

chrome: icon-only tooltip for keyboard focus only where nothing hovers; never an empty control

From the review (Claude Fable): on a tablet a tap leaves :hover on the
lens and its tooltip stayed up until the next tap elsewhere, so under
(hover: none) it shows for :focus-visible only. And IconOnly without an
Icon now draws the label as usual instead of an empty control.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 9171e86504647c7a6858da46392ebaac25e72d98 parent 311a281
4 files changed, +18 −5
  • chrome/chrome.css +6 −0
  • chrome/chrome.go +2 −1
  • chrome/stack_test.go +5 −0
  • chrome/templates/bar.html +5 −4

CI passed — run details

diff --git a/chrome/chrome.css b/chrome/chrome.css
index 024bfe3..92d0fd4 100644
--- a/chrome/chrome.css
+++ b/chrome/chrome.css
@@ -625,6 +625,12 @@
[estilo-bar-actions] [estilo-bar-icon] { inline-size: 32px; min-inline-size: 32px; }
[estilo-bar-actions] [estilo-bar-icon]::before { content: ""; position: absolute; inset: -6px; }
}
+ /* Where nothing hovers (a tablet), a tap leaves :hover on the control,
+ and the tooltip would stay up until the next tap elsewhere. There it
+ shows for keyboard focus only. */
+ @media (hover: none) {
+ [estilo-bar-actions] [estilo-bar-icon]:not(:focus-visible)::after { display: none; }
+ }
}
@media (min-width: 64rem) {
:is([estilo-bar~="stacked"], [estilo-bar]:has([estilo-bar-lead])) [estilo-bar-end]:has(> [estilo-bar-actions]) > [estilo-account] {
diff --git a/chrome/chrome.go b/chrome/chrome.go
index df73284..01a1606 100644
--- a/chrome/chrome.go
+++ b/chrome/chrome.go
@@ -134,7 +134,8 @@ type Action struct {
// Fichas' Search, 2026-11-18). Label is then its accessible name
// (aria-label) and, followed by Key when there is one, its tooltip on
// hover and focus: rastrillo's rst-tip, so "Search ⌘K". The Menu
- // sheet's row is unchanged, label and key. Set it only with an Icon.
+ // sheet's row is unchanged, label and key. Without an Icon it is
+ // ignored and the label shows.
IconOnly bool
// KeyShortcuts is the bar control's aria-keyshortcuts, in ARIA's own
// spelling ("Meta+K Control+K"): Key is the shortcut people read,
diff --git a/chrome/stack_test.go b/chrome/stack_test.go
index 8ebc578..537702a 100644
--- a/chrome/stack_test.go
+++ b/chrome/stack_test.go
@@ -417,6 +417,11 @@ func TestAnIconOnlyActionIsNamedButShowsNoText(t *testing.T) {
t.Errorf("without a key: %s", got)
}
+ // IconOnly with no icon would be an empty control: the label shows.
+ if got := render(t, "estilo-bar-action", Action{Item: menu.Item{Href: "/s", Label: "x-search"}, IconOnly: true}); got != `<a rst-btn href="/s">x-search</a>` {
+ t.Errorf("IconOnly without an icon: %s", got)
+ }
+
for _, it := range []menu.Item{{Action: "/p", Label: "l"}, {Dialog: "d", Label: "l"}, {Controls: "c", Label: "l"}} {
got := render(t, "estilo-bar-action", Action{Item: it, Icon: icon, IconOnly: true})
if !strings.Contains(got, ` aria-label="l" estilo-bar-icon rst-tip data-tip="l"><svg aria-hidden="true"></svg></button>`) {
diff --git a/chrome/templates/bar.html b/chrome/templates/bar.html
index 05c33ec..b6be10d 100644
--- a/chrome/templates/bar.html
+++ b/chrome/templates/bar.html
@@ -96,10 +96,11 @@
shows its icon alone, carries its label as aria-label, and shows
the label and Key as a tooltip on hover and focus (rastrillo's
rst-tip, drawn from the estilo-bar-icon box). KeyShortcuts, when
- set, is the control's aria-keyshortcuts. Neither writes a byte for
- an action that sets none of these. */}}
-{{define "estilo-bar-action-name"}}{{with .KeyShortcuts}} aria-keyshortcuts="{{.}}"{{end}}{{if .IconOnly}} aria-label="{{.Label}}" estilo-bar-icon rst-tip data-tip="{{.Label}}{{with .Key}} {{.}}{{end}}"{{end}}{{end}}
-{{define "estilo-bar-action-face"}}{{.Icon}}{{if not .IconOnly}}{{.Label}}{{end}}{{end}}
+ set, is the control's aria-keyshortcuts. IconOnly with no Icon
+ draws the label as usual: a control is never left empty. Neither
+ writes a byte for an action that sets none of these. */}}
+{{define "estilo-bar-action-name"}}{{with .KeyShortcuts}} aria-keyshortcuts="{{.}}"{{end}}{{if and .IconOnly .Icon}} aria-label="{{.Label}}" estilo-bar-icon rst-tip data-tip="{{.Label}}{{with .Key}} {{.}}{{end}}"{{end}}{{end}}
+{{define "estilo-bar-action-face"}}{{.Icon}}{{if not (and .IconOnly .Icon)}}{{.Label}}{{end}}{{end}}
{{/* estilo-bar-title: the open object's title, editable in place. A real
form, so Enter renames with scripts off. The submit button is visually