Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Details component announces its default and expanded state 1 time but not subsequent times using NVDA #754

Closed
mcheung-nhs opened this issue Jul 9, 2021 · 3 comments · Fixed by #773

Comments

@mcheung-nhs
Copy link
Collaborator

Bug Report

What is the issue?

When using the details component with NVDA, expanding the summary text announces the 'expanded' state and when closing it, the 'collapsed' state is announced. However, subsequent opening and closing does not get announced.

What steps are required to reproduce the issue?

  1. Go to a page with the details component, eg. https://www.nhs.uk/medicines/paracetamol-for-children/
  2. Go to section 10, Common Questions
  3. Enable NVDA and listen when expanding and collapsing any of the common questions details/summary components.
  4. Observe that the first time you expand and collapse, it is announced. However, on subsequent time, it is not announced.

What was the environment where this issue occurred?

  • Device: Windows Surface Pro 4
  • Operating System: Windows 10
  • Browser:Firefox
  • Browser version: 89.0.2
  • NVDA version 2020.4

Is there anything else you think would be useful in recreating the issue?

No

@andymantell
Copy link
Contributor

I can reproduce this, on NVDA 2020.4 and 2021.1 in Firefox.
It doesn't occur in Chrome.
And crucially, it doesn't occur when I made a codepen with a really basic details element, so there's something uniquely wrong with the nhsuk-frontend one.

Will investigate...

@andymantell
Copy link
Contributor

It appears that the JS polyfill that we are using and applying regardless of the presence of native details/summary support is actually making it worse in Firefox. When I disable this JS, Firefox starts behaving properly.

Speaking to @tomdoughty - this polyfill was put in at a time when even browsers that did support it, didn't support it well, and screenreaders were not announcing the state correctly.

However, it appears time has moved on, and support for the native element and assistive tech is better than it was. I feel therefore that we should only initialise the polyfill when support for the native element is not present.

This is backed up by this commit from govuk-frontend:
alphagov/govuk-frontend@f5cfa5f

At the moment, we do still need the polyfill for IE11 however so we cannot yet remove it entirely.

andymantell added a commit that referenced this issue Sep 16, 2021
This fixes an issue with Firefox / NVDA not announcing the open state of the element.
Fixes #754

See also alphagov/govuk-frontend@f5cfa5f
@andymantell
Copy link
Contributor

Weirdly I seem to no longer be able to reproduce this issue! I could do this morning, but NVDA has updated itself since and now I can't get back to a broken state.

Nevertheless, I think the fix in the attached pull request is sensible anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants