I am trying to fix an accessibility bug for screen reader in an Angular2 web application. In Chrome, when componentA(code under Before) gets loaded, the focus is the whole browser window and screen reader narrator announces the title of the componentA's page. However, in Edge, the focus stays the same as previous page which results in the title is not announced. The goal is no matter in which browser, the title should be announced once and only once.
I tried the solution by modifying componentA.html (code under After) and set focus to componentA-id in ngOnInit(). i.e.:
document.getElementById('componentA-id').focus();
Now in Edge, the narrator can correctly foucus on the whole componentA and announce the title of componentA. However in Chrome, the whole window is focused and the componentA is also focused, which results in the title is annouced twice. Is there any way I can disable the Chrome focus or is there any other ways to solve this problem to achive my goal?
Before: componentA.html
<div>
<div title="ComponentA Title" role="banner">ComponentA Title</div>
...
...
</div>
After: componentA.html
<div aria-label="ComponentA Title" id="componentA-id" tabindex="-1">
<div title="ComponentA Title">ComponentA Title</div>
...
...
</div>