Skip to content

fix(gameui): follow up on the merged gameui pull requests - #2481

Open
houko wants to merge 12 commits into
mainfrom
fix/followup-ui-input-text-1
Open

houko wants to merge 12 commits into
mainfrom
fix/followup-ui-input-text-1

Conversation

@houko

@houko houko commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up review of the gameui, a11y and text pull requests the merge train landed without CI. Each section is checked against current main.

#2089 feat(a11y): bridge sound and dialogue captions

Duplicate. Another pull request for #1774 had already added a11y.CaptionEmitter and cutscene.CaptionBridge, and the merge kept both. a11y.CaptionBridge.ShowSFXAt duplicated CaptionEmitter.Emit on a separate clock the game had to advance itself, SyncDialogue duplicated cutscene.CaptionBridge, and nothing used it. Its guide sections repeated the existing Captions for positional sounds and Captions for dialogue headings (breaking the anchors a11y.md links to) and told cutscene authors to call it from OnDialogue instead of the documented bridge. It was never released (0.4.0 does not contain it), and a zero-value CaptionBridge{Track: t} panicked on its nil map.

This PR removes pkg/a11y/bridges.go, its test, its doc sections in a11y.md, sound.md and cutscene.md (en and zh), its changelog fragment and its note, and records the rejected alternative in the captioned sound and dialogue note.

#2097 fix(gameui): honor full text scale range

The code landed intact: SettingsMenu.applyTheme uses save.MinCaptionScale–save.MaxCaptionScale. As a second attempt at #1772 it added a second agent note and a second changelog fragment for the same change, and two paragraphs in the gameui guide that said the same thing. This PR folds the second note into the first, drops the duplicate fragment, and merges the paragraphs.

Its merge into the train also replaced the end of docs/en/gameui.md and docs/zh/gameui.md with an older copy, which removed every section the PRs below added.

Closes #1772 overstates it: the issue's acceptance also asks for Root.HUDScale and a HUD scale row, a CheckScreen minimum text size issue (IssueTextTooSmall), defaulting the root scale to the player setting or Env().FontScale(), and before/after screenshots. None of these exist, and the issue is closed.

#2291 feat(gameui): add dropdown menu model

The guide section was lost (restored here). Menu.NextEnabled computed (i + step + len) % len, which is negative and panics for a large negative step or index, such as NextEnabled(0, -5), and it could return an item without an ID that Selectable refuses. It now moves one item in the step's direction, starts an out-of-range index from the matching end, and skips exactly what Selectable refuses, with a table test.

#2292 feat(gameui): add deterministic grid layout helper

The guide section was lost (restored). The body says invalid inputs are covered by tests, but none were. Spacing wider than the bounds gave negative cell sizes. Cell sizes are now clamped at zero, and the tests cover zero counts, zero columns, negative spacing and oversized spacing.

#2293 feat(gameui): add portable text input validation

The guide section was lost (restored). PrintableOnly removed only C0 controls and DEL, so C1 controls such as U+0085 reached the field. It now uses unicode.IsControl. Also added: a doc note that invalid UTF-8 becomes U+FFFD, and doc comments on KeyboardKind constants and TextInputOptions fields.

#2294 feat(gameui): add pointer filter contract

The guide section was lost (restored). ShouldConsume returned true for PointerPass, which contradicts ResolvePointerFilter and the guide. Only PointerStop consumes now, a test pins the two together, and the constants have doc comments.

#2295 feat(gameui): add rich text link model

The guide section was lost (restored). ParseRichLinks searched for a tag's ] across newlines and nested [, unlike ParseRich, so in a [b [link=x]X[/link] the link was lost. It now scans the way ParseRich does, with a test. Not changed here (open in #1417): ParseRich has no link tag, so RichText.PlainText still contains the literal [link=…] markup that ParseRichLinks excludes from its offsets. Unmatched closing tags are also handled differently by the two parsers.

#2305 feat(gameui): add accessibility node model

The guide section was lost (restored). Accessible treated an unnamed group as accessible, but RequiresName flagged it. Groups are now exempt in both, a test checks that the two are inverses for visible nodes, and the roles have doc comments.

#2354 feat(gameui): add credits about model

Overwritten. The commit of the closed #2356 reached main through a merge and replaced Credits, Credits.Valid and CreditEntry.Author with a near-duplicate CreditsModel. 0.4.0 had already released Credits and its changelog entry. This PR restores Credits and keeps that attempt's stable Sorted as a method on it. CreditsModel is removed because nothing used it, and its note is folded into the credits note. The guide section is restored.

#2402 feat: add gameui custom widget adapter

The guide section was lost (restored). The only test, TestCustomWidgetMeasuresAndDraws, did not measure, lay out or draw anything. It only checked that NewRoot returns non-nil. A Custom with a nil Impl was focusable. It no longer is, and the tests now cover measurement with MinWidth, layout, drawing, Focusable and HitTest. The adapter still has no activation or pointer input path for the widget (customPointer is declared but unused), so #1412 stays open.

Not in this PR

Other lines that the same merge dropped from the gameui guide belong to other pull requests: l10n.MirrorRect / ReadingOrder, theme styleBoxes, and text.TextEffects. The sound.md positional caption section also contains unrelated paragraphs (animation sounds, scene emitters, sound and music resources, dynamics, software mixer) that other merges left in the wrong section.

Verification

  • go tool nsgo test ./pkg/gameui/... ./pkg/text/... ./pkg/a11y/... ./pkg/cutscene/...: pass.
  • go tool nsgo check on ./pkg/gameui/..., ./pkg/text/... and ./pkg/a11y/...: pass.
  • go tool nsgo test ./internal/repocheck/...: pass.
  • go run ./tools/changelog check and bun run verify-notes: pass.

Screenshots

None

houko added 12 commits November 30, 2026 01:12
The merge of #2097 into the merge train replaced the end of docs/en/gameui.md and docs/zh/gameui.md with an older copy, dropping the custom widget, credits, dropdown menu, grid layout, text input, pointer filter, rich label and accessibility node sections that #2291, #2292, #2293, #2294, #2295, #2305, #2354 and #2402 added, and left two settings-menu text scale paragraphs that said the same thing. Restore the sections, describe the code as it now behaves, and merge the two paragraphs into one.
The commit of the closed #2356 reached main through a merge and replaced the `Credits` type, its `Valid` method and the `Author` field that #2354 added and 0.4.0 released with a near-duplicate `CreditsModel`. Restore `Credits`, keep the stable `Sorted` from the duplicate as a method on it, drop `CreditsModel` (nothing used it), and fold its note into the credits note.
#2089 added `a11y.CaptionBridge` for #1774 while another pull request for the same issue added `a11y.CaptionEmitter` and `cutscene.CaptionBridge`, and the merge train kept both. Its `ShowSFXAt` duplicated `CaptionEmitter.Emit` on a separate clock, its `SyncDialogue` duplicated `cutscene.CaptionBridge`, nothing used it, it was never released, and the guide sections it added to the sound and cutscene pages repeated the existing headings and told cutscene authors to use it instead of the documented bridge. Remove it with its docs, changelog fragment and note, and record the rejected alternative in the captioned sound and dialogue note.
…ment

#2097 was a second attempt at #1772 and added a second agent note and a second changelog fragment for the settings menu text scale range, which the first note and the `1772-gameui-text-scale` fragment already describe. Fold the one reason the second note added into the first and drop the duplicates, so the release notes list the change once.
…erFilter

#2294 made `ShouldConsume` true for `PointerPass`, while `ResolvePointerFilter` and the guide say a pass filter reports the hit and lets it propagate. Only `PointerStop` consumes now, and the filter constants have doc comments.
#2291 computed the next index as `(i + step + len) % len`, which is negative and panics for a step or an index beyond one length below zero, such as `NextEnabled(0, -5)`, and it could land on an item without an ID that `Selectable` refuses. Move one item in the direction of the step, start an out-of-range index from the matching end, and skip exactly the items `Selectable` refuses.
#2293 removed only C0 controls and DEL with `PrintableOnly`, so C1 controls such as U+0085 NEXT LINE reached the native field. Use `unicode.IsControl`, document that invalid UTF-8 becomes U+FFFD, and add doc comments to the keyboard kinds and options.
#2305 treated an unnamed group as accessible in `Accessible` but as missing a name in `RequiresName`. Exempt groups in both, and add doc comments to the roles.
#2292 said it covered invalid inputs, but spacing wider than the bounds produced negative cell sizes and its test covered none of the normalizations. Clamp cell sizes at zero and test zero counts, zero columns, negative spacing and oversized spacing.
#2402 made a `Custom` with a nil `Impl` focusable, and its only test checked that a new root is not nil. A nil `Impl` is no longer focusable, and the tests now measure, lay out and draw a custom widget and cover `Focusable` and `HitTest`.
#2295 searched for the closing bracket of a tag across newlines and nested brackets, so in `a [b [link=x]X[/link]` it read `[b [link=x]` as one literal tag, lost the link and miscounted offsets that ParseRich renders differently. Scan for the bracket the way ParseRich does.
@github-actions github-actions Bot added size/L bug Something isn't working documentation Improvements or additions to documentation pkg/text area/agents pkg/gameui pkg/a11y labels Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agents bug Something isn't working documentation Improvements or additions to documentation pkg/a11y pkg/gameui pkg/text size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant