# 无障碍：导航时向屏幕阅读器发送信号变更

**URL:** https://meta.discourse.org/t/accessibility-signal-changes-to-screen-readers-on-navigation/77897
**Category:** Feature
**Tags:** accessibility
**Created:** [2018年一月12日 22:27 UTC](https://meta.discourse.org/t/accessibility-signal-changes-to-screen-readers-on-navigation/77897 "2018-01-12T22:27:54Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![kevinrobinson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinrobinson/32/120056_2.png) [@kevinrobinson](https://meta.discourse.org/u/kevinrobinson)
#### Post date: [2018年一月18日 20:25 UTC](https://meta.discourse.org/t/accessibility-signal-changes-to-screen-readers-on-navigation/77897/6 "2018-01-18T20:25:21Z")

</div>

@riking this is awesome, thanks for chiming in! 🙂

It sounds like you have a bit more context on the pieces involved here than I do, but on first read it looks to me like the issue you’re bringing up is around focus management and navigation between topics (similar to [Accessibility: Need way to browse between messages quickly - #3 by kevinrobinson](https://meta.discourse.org/t/accessibility-need-way-to-browse-between-messages-quickly/77901/3) and then you split that out to here: [Accessibility: Focus management in topics - #3 by riking](https://meta.discourse.org/t/accessibility-focus-management-in-topics/78109/3)). And so I’ll leave those aside here and talk about those further over there. If I’m mixed up or missing something please chime in!

So for the original issue on this thread, I think we could try @sam’s awesome suggestion to use the `onPageChange` hook. I can see how it works [here](https://github.com/discourse/discourse/blob/718e932b44dde8c78d876c1e26480af7883a5c8a/app/assets/javascripts/discourse/lib/plugin-api.js.es6#L348), and the only question is where to enable that hook. I think we’d want to have this be enabled by default (with opt-out possible) and not a separate plugin.

If I’m reading through the code correctly, it looks like a new `initializer` in [here](https://github.com/discourse/discourse/tree/5dbd6a304bed5400be481d71061d3e3ebb4d6785/app/assets/javascripts/discourse/initializers) would be the right place to add in that call to `api.onPageChange`. For now we could just have it do something like:

```plaintext
   api.onPageChange((url, title) => {
       Em.run.next(()=>{
           // insert the .screen-reader-only div if it isn't on the page already
           var screenReaderOnlyEl = document.getElementById('screen-reader-only-announcer');
           if (!screenReaderOnlyEl) {
             $('body').append('<div id="screen-reader-only-announcer" aria-live="polite"> </div>');
             screenReaderOnlyEl = document.getElementById('screen-reader-only-announcer');
           }
           $(screenReaderOnlyEl).text('Page changed to: ' + title);
       });
    });

```

Does this seem like a reasonable first step?

---

_[View the full topic](https://meta.discourse.org/t/accessibility-signal-changes-to-screen-readers-on-navigation/77897)._
