Skip to content
Accessibility

Accessibility

Bellui draws its widgets itself, so the operating system cannot see them the way it sees native controls. To make an app usable with a screen reader, Bellui describes each widget to the platform’s accessibility API: what it is (a button, a checkbox, a slider), its name, its value and state, and what can be done with it.

Turn it on

Screen-reader support is compiled in only when you build with the accessibility tag:

go build -tags accessibility .

Without the tag, the description of each widget still exists in your code, but nothing passes it to the operating system, and the app is invisible to screen readers. Make sure the tag reaches every build you ship.

What each platform gets

PlatformAccessibility APINotes
macOSNSAccessibility, used by VoiceOverText fields support caret and selection. Headings feed VoiceOver’s heading navigation. Extra actions appear in VoiceOver’s actions menu.
WindowsUI Automation, used by Narrator and NVDAButtons, toggles, expand and collapse, selection, values and ranges, text, and grids. Announcements need Windows 10 version 1709 or later. Rename and delete actions are not exposed.
LinuxAT-SPI2 over D-Bus, used by OrcaWritten in Go, with no C library to install. When the desktop has no accessibility bus, it does nothing.
AndroidAndroid accessibility, used by TalkBackExtra actions appear in TalkBack’s actions menu. The tree is only built while an accessibility service is running.
iOSUIKit accessibility, used by VoiceOverSupports activating, adjusting values, dismissing with the escape gesture, and editing text.
WebnoneThere is no screen-reader support in the browser build.

On every platform the screen reader gets the same information from the same widget code:

  • Role: one of about 45 kinds, from button and checkbox to table cell and heading.
  • Name: the button text, the label text, the entry’s placeholder, or a name you set.
  • Value: the text in an entry, a slider’s position, a date picker’s date.
  • State: checked, selected, expanded, disabled, focused, read-only, required, modal.
  • Actions: press, toggle, increment, decrement, expand, collapse, select, dismiss, and for some widgets rename, delete, undo and redo.

Most standard widgets describe themselves: buttons, checks, radio groups, switches, entries, selects, sliders, progress bars, lists, tables, trees, tabs, menus, navigation bars and rails, date and time pickers, toasts, dialogs and more. A widget that can be disabled is reported as disabled automatically.

Elements are listed in the order they appear in the widget tree, which is the order a screen reader reads them. Under a right-to-left layout the order stays the same and only the positions are mirrored.

Things that are not described: decorative images and icons (canvas.Image, widget.Icon), and anything you draw yourself with canvas objects. Wrap them in a widget of your own if they carry meaning. See Accessible custom widgets.