Accessibility: Focus management in topics

I think that fixing the J/K navigation focus management will fix the first linked topic, and is a prerequisite for solving the second topic.


List of problems noticed before creating this:

  • Posts need to be focusable in order to properly direct the screen reader to the first post it should be reading. I think that setting tabindex=0 and custom :focus styling is the best way to do this.

  • Post controls have outline: 0 set, and no custom :focus styles. This removes all focus styling from the buttons. I suggest applying the .d-hover rules to the :focus state.

  • Activating the “show more” post action blurs focus; it should focus the first revealed button.


Here’s a PR. Does not fix the issue.

Wrote the comment entirely with my keyboard after I decided that would be a good idea, and found another issue: we need a shortcut to focus the composer textarea. It was extremely annoying to get my focus back in the composer, especially because it’s not where I expected it to be in the taborder.


Ok then make it so… small PRs that do individual specific things are easier to process than giant swaths of kitchen sink work.


Made a separate PR for composer refocus and restore from collapsed:


@riking this looks awesome! :slight_smile: It looks like you have a better understanding than I do of how to implement these changes within Discourse, but the gist of these changes look great to me. Let me know if I can help at all!

1 Like