base: Radio has no LabelFunc or HintFunc, unlike Checkbox and Button

Aperta
#2,059 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@houko ci sta già lavorando.

Dal 23/11/2026.

  • #2181 di @houko — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Context

base.Radio (base/radio.go:12) takes a fixed Label string but no LabelFunc, while its siblings do: base.Checkbox (base/checkbox.go:40) and base.Button (base/button.go:42) both accept LabelFunc func() string and pass it to core.View.LabelFunc. Radio has no HintFunc either, which Checkbox also has.

Why it matters

A radio whose accessible name depends on state can't keep it current. ui.FormRow with RoleRadio (since #1888) binds its row title through TitleFunc/LabelFunc, but for a radio row it can only read the bound label once at render, because base.Radio has nowhere to put the function. Screen readers then announce a stale name after the label changes.

Proposal

Add LabelFunc func() string and HintFunc func() string to base.Radio with the same meaning as on base.Checkbox (the function wins over the string when set), pass them through to the radio's core.View, and let ui.FormRow's radio role forward its bound label instead of reading it once.

Acceptance
  • A base.Radio with a LabelFunc whose result changes reports the new accessible name without a re-render of its parent, as base.Checkbox does (a test like Checkbox's).
  • ui.FormRow with RoleRadio and a changing TitleFunc updates the radio's accessible name.
Lingua principale
Go
Stelle
684
Fork
41
Merge medio
8h 8m
PR unite (30g)
911

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nsgo-dev/nsgo

Tutte le issue di nsgo-dev/nsgo

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.