Which approach should an SDL application use to make a custom-drawn UI accessible to screen readers?
0 reputation · 08 Feb 2020, 11:52 UTC
0 reputation · 08 Feb 2020, 11:52 UTC
Our application renders its entire user interface through SDL (Simple DirectMedia Layer), drawing menus and dialogs onto a single window surface. We now need this workflow to be usable with screen readers such as NVDA and VoiceOver, not just with keyboard-only input.
From what I understand, SDL is a low-level windowing and input layer: it delivers keyboard events and offers SDL_StartTextInput for IME-aware text entry, but it does not populate the platform accessibility tree (UIA, AT-SPI, NSAccessibility) for custom-rendered content. That leaves the window effectively opaque to assistive technology unless the application adds something itself. I also could not find a documented cross-platform SDL API for announcing dynamic content changes, such as live-region-style updates when a dialog opens.
We are targeting SDL2 today, with SDL3 migration under consideration, so version differences in text input handling matter to us.
Is building per-platform accessibility bridges the accepted approach, or is embedding an accessible UI toolkit alongside SDL more practical in real projects? Does the answer change between SDL2 and SDL3? And is there any documented pattern for announcing dynamic content changes to screen readers from an SDL-rendered UI?
Build an accessibility bridge that exposes each custom‑drawn control to the operating system’s accessibility API (UI Automation/IAccessible2 on Windows, NSAccessibility on macOS, AT‑SPI on Linux) and forward SDL input events to that bridge. Use the platform’s live‑region mechanism to announce dynamic changes such as dialog openings or status updates.
LiveSettingChanged event, NSAccessibility AXLiveSettingChanged, or AT‑SPI object:live-region-changed).button, slider, listitem, dialog, …) and set its name (label) and any needed description or value.press, click) are reported to the screen reader.LiveRegionChanged event with the dialog’s title or message).If you need to support multiple platforms, let me know which operating systems you target so I can suggest whether a cross‑platform accessibility library (e.g., AccessKit) would reduce duplicated bridge code.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.