feat: Accessibility mode for screen reader users #8563
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds an accessibility mode for screen reader users. Animations, emojis and unicode characters add extra information to what the text to speech voice is reading, which is often meaningless and only there to look nice. These are removed in accessibility mode to make the interface cleaner and easier to read. A prime example of this is the spinner which is modified in the PR. When the spinner updates and you're reviewing text with the screen reader, it immediately loses focus because text was updated and the window changed, and in that instance the safest thing to do is focus the bottom of the window. Instead, the spinner now shows as [busy] when the AI is working. Numbering in menus is also introduced, because screen readers don't announce what TUI item is focused so in any dialog or menu, a blind user has to guess what option is selected and use the arrow keys to hopefully find the option they want. Now you type the number you want to go to, and press enter to activate it. These configs are exposed in tui.accessibility. Anyone without the config options set will not have their workflows changed and the UI will remain the same as it always has. Disclaimer, codex was used entirely to make these fixes as I'm not familiar with JS and everything around it but know other languages quite well. Fixes #8565
How did you verify your code works?
Set the config options and ran bun run dev in the packages/opencode directory and tested going to the models dialog with /models and ctrl x m, tested sessions with /sessions. Typed numbers when numbered menus were active and the menu options triggered the expected config dialogs. Disabled and enabled both options to confirm the UI preserved the original functionality and original look compared to the accessible variant. Used / to focus the search box in accessibility mode and confirmed that search worked and in the original UI as well.