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

Accessibility Issue: keyboard-only users cannot interact with "show more" #3073

Open
hostle83 opened this issue May 23, 2024 · 4 comments · May be fixed by #3212
Open

Accessibility Issue: keyboard-only users cannot interact with "show more" #3073

hostle83 opened this issue May 23, 2024 · 4 comments · May be fixed by #3212
Assignees

Comments

@hostle83
Copy link

Describe the bug
Keyboard-only users cannot expand text that is hidden and needs to be expanded for full view. This issue applies to all instances where the "show more" functionality is used.

To Reproduce
Steps to reproduce the behavior:
Reproducible both in demo & sandbox. See image.
2 1 1-show-more-does-not-work-with-keyboard-nav

Expected behavior
A keyboard-only user should be able to expand the text without needing a mouse to click on the text.

@hostle83 hostle83 added bug needs triage New issue needs triage and/or scheduling labels May 23, 2024
@tdonohue tdonohue added accessibility help wanted Needs a volunteer to claim to move forward and removed needs triage New issue needs triage and/or scheduling labels May 23, 2024
@autavares-dev
Copy link
Contributor

The template for the expand and collapse buttons binds to the actualClick event, defined by the dsDragClick directive.

According to the code comments, this directive is for preventing drag events being misinterpret as clicks. Manually testing the page (on 7.6.x) without this directive and binding to the click event, the only way I was able to make a drag be interpreted as a click was to start and end the drag over the 'Show more'/'Collapse' text.

Keyboard navigation for buttons will trigger the click event when activating the button (not being used).

It's simple to fix the problem, I just don't know if there are good reasons to keep the dsDragClick directive and actualClick event.

The current code is:

<button class="btn btn-link p-0 expandButton" dsDragClick (actualClick)="toggle()">
...

The options are:

  • Alternative 1, keep the actualClick binding and add the event bindings for specific keys:
    <button class="btn btn-link p-0 expandButton" dsDragClick (actualClick)="toggle()"
      (keyup.Enter)="toggle()" (keyup.Space)="toggle()"
    >
  • Alternative 2, change to click event and remove the dsDragClick directive:
    <button class="btn btn-link p-0 expandButton" (click)="toggle()">
    ...

@tdonohue
Copy link
Member

@autavares-dev : Thanks for the analysis. I have to admit, I don't know this area of the code well, but I'm all in favor of simplification. If replacing the custom actualClick with click doesn't have any side effects in the behavior, then that seems reasonable to me. However, if we find side effects of that change, your "Alternative 1" seems like the better approach.

So, I don't have a strong preference, but we'd need to carefully test that switching to click doesn't cause side effects to the behavior of these "show more" buttons. (It's always possible though that the actualClick event was added to fix an issue that is no longer occurring...it looks like it was first introduced 6 years ago in #221, and we have upgraded Angular several times since then.)

If you'd like to claim this ticket and provide a PR, please let me know!

@autavares-dev
Copy link
Contributor

I would like to claim the task.

It seems safer to me to use the first alternative, by including the space and enter keys.
By this document, it is enough using those two keys.

It would be difficult to be sure that no unwanted side effects were added by manually testing/clicking the button occurrences.

@tdonohue tdonohue removed the help wanted Needs a volunteer to claim to move forward label May 29, 2024
@tdonohue
Copy link
Member

Thanks @autavares-dev ! I've assigned the task to you. Please feel free to send along a PR whenever you are able to complete the task. See our contributing guidelines for more details as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In Progress
Development

Successfully merging a pull request may close this issue.

3 participants