oficina / docs Public

The large title's button says it renames

Fable on #179 (minor): the title is a button whose name is the title; it
now has a description, "Rename" (the catalog's docs.chrome.title.rename),
so a screen reader says what pressing it does.
TestTheTitleButtonSaysItRenames fails without it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 02c2122d456b5389f71fa3f6f2b6762d9f70b77d parent e10ff41
2 files changed, +12 −1
  • internal/docs/phone_test.go +10 −0
  • internal/docs/views/show.html +2 −1
diff --git a/internal/docs/phone_test.go b/internal/docs/phone_test.go
index 65d3f45..278803a 100644
--- a/internal/docs/phone_test.go
+++ b/internal/docs/phone_test.go
@@ -257,3 +257,13 @@ func TestAaControlsTheStrip(t *testing.T) {
t.Error("the strip has no id for Aa to name")
}
}
+
+// The large title is a button that renames, and says so: its name is the
+// title, its description the verb (Fable on #179).
+func TestTheTitleButtonSaysItRenames(t *testing.T) {
+ _, _, pages := people(t, "Minutes")
+ block := section(t, pages["writer"], "<div docs-title-block", "<div docs-chrome>")
+ if !strings.Contains(block, `<button type="button" docs-title-edit aria-describedby="docs-title-edit-says">`) || !strings.Contains(block, `<span id="docs-title-edit-says" hidden>docs.chrome.title.rename</span>`) {
+ t.Errorf("the title button has no description saying it renames:\n%s", block)
+ }
+}
diff --git a/internal/docs/views/show.html b/internal/docs/views/show.html
index d72f2de..6802b7d 100644
--- a/internal/docs/views/show.html
+++ b/internal/docs/views/show.html
@@ -1858,7 +1858,8 @@
<div docs-title-block id="docs-title">
{{- if .CanWrite}}
<form docs-title-form method="post" action="/d/{{.Sqid}}/title">
-<h1 docs-title dir="auto"><button type="button" docs-title-edit><span docs-title-text>{{.Title}}</span></button></h1>
+<h1 docs-title dir="auto"><button type="button" docs-title-edit aria-describedby="docs-title-edit-says"><span docs-title-text>{{.Title}}</span></button></h1>
+<span id="docs-title-edit-says" hidden>{{.Large.Rename}}</span>
<input docs-title-input id="docs-title-input" name="title" value="{{.Title}}" maxlength="256" aria-label="{{.Large.TitleLabel}}" aria-describedby="docs-title-hint" autocomplete="off" spellcheck="false" dir="auto" enterkeyhint="done">
<p docs-title-hint id="docs-title-hint">{{.Large.TitleHint}}</p>
<button rst-btn type="submit" docs-title-submit>{{.Large.Rename}}</button>