Bug 1799153 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Thanks for putting a patch together so soon. The current patch would also focus any "Learn More" links if it appears before a form input. For example `openPreferences("privacy-sitedata")`, which is used in firefox.

Just to add some context to why I opened the bug, in tor browser we have additional calls to `openPreferences` and one of them would also include a "Learn More" link.

I feel like there are two possible approaches:

1. Expect immediate user input. In this case we want to focus the first form element. A link would not be considered a form element.
2. Expect user to read the heading and introductory text. In this case we want to focus the element's heading.

After thinking about this, I think option 2 is better for screen reader users and is a safer fall back.

One way to do this would be to make the scrolled to groupbox or its heading element focusable without making it part of the Tab sequence by setting `tabindex` to `-1`. You can even move focus and then make it non-focusable again. E.g. you could do

```js
  header.setAttribute("tabindex", "-1");
  header.focus();
  header.removeAttribute("tabindex");
````

This will move focus for a screen reader to the top of the group and place the screen reader in a browsing mode and from here pressing Tab once will take you to the "Learn More" link or the form input.

Or maybe there is a more privileged accessibility or focus tool that can do the same sort of thing.
Thanks for putting a patch together so soon. The current patch would also focus any "Learn More" links if it appears before a form input. For example `openPreferences("privacy-sitedata")`, which is used in firefox.

Just to add some context to why I opened the bug, in tor browser we have additional calls to `openPreferences` and one of them would also include a "Learn More" link.

I feel like there are two possible approaches:

1. Expect immediate user input. In this case we want to focus the first form element. A link would not be considered a form element.
2. Expect user to read the heading and introductory text. In this case we want to focus the element's heading.

After thinking about this, I think option 2 is better for screen reader users and is a safer fall back.

One way to do this would be to make the scrolled to groupbox focusable without making it part of the Tab sequence by setting `tabindex` to `-1`. You can even move focus and then make it non-focusable again. E.g. you could do

```js
  header.setAttribute("tabindex", "-1");
  header.focus();
  header.removeAttribute("tabindex");
````

This will move focus for a screen reader to the top of the group and place the screen reader in a browsing mode and from here pressing Tab once will take you to the "Learn More" link or the form input.

Or maybe there is a more privileged accessibility or focus tool that can do the same sort of thing.

Back to Bug 1799153 Comment 5