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

support for disabled buttons for screen readers #3268

Conversation

jensvannerum
Copy link
Contributor

@jensvannerum jensvannerum commented Aug 27, 2024

References

Add references/links to any related issues or PRs. These may include:

Description

Replaced the html disabled attribute with a custom directive which has the same effect.
The directive is however friendly for screen readers using aria attributes and being focusable with keyboard navigation

Instructions for Reviewers

  • Go to any page that uses a disabled state (e.g login page) and verify behaviour is as expected.
  • Verify the aria-disabled attribute is present on the disabled element for the screen reader

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@jensvannerum jensvannerum added port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release accessibility labels Aug 27, 2024
@tdonohue tdonohue removed port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Aug 27, 2024
Copy link

Hi @jensvannerum,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@tdonohue tdonohue self-requested a review September 12, 2024 15:01
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jensvannerum : We gave this a group review in our Developer Meeting today. Overall the feedback was positive, but I've added a few notes inline on issues found during the meeting (and just after the meeting as I scanned it again).

Also noted in the meeting is that we should add a note to our Accessibility documentation guidelines about this new dsDisabled directive (and to avoid using disabled). We have a page with very basic notes in both the 7.x and 8.x docs:

src/app/shared/disabled-directive.ts Outdated Show resolved Hide resolved
src/app/shared/disabled-directive.ts Outdated Show resolved Hide resolved
src/app/shared/disabled-directive.spec.ts Show resolved Hide resolved
@tdonohue tdonohue added the needs documentation PR is missing documentation. All new features and config changes require documentation. label Sep 12, 2024
Jens Vannerum added 4 commits September 16, 2024 10:56
…for-disabled-elements-for-screen-readers-9.0
- added typedocs
- changed directive to only be present for buttons
- various other small fixes
@jensvannerum
Copy link
Contributor Author

@tdonohue Thanks for the feedback, I feel like I addressed all of it.

Note that I also reduced the scope of this PR a little, the directive is currently only present on buttons.
I did this because developers might otherwise expect this to replace the disabled attribute of HTML everywhere, which isn't the case yet. It would disable keystrokes and mouse clicks but wouldn't have the same "disabled look" as the actual HTML attribute gives it (90% usage of the disabled attribute in DSpace is on button anyways so still a huge improvement for accessibility).

Backported changes to 8.x and 7.x PR's too

@jensvannerum jensvannerum force-pushed the w2p-117544_support-for-disabled-elements-for-screen-readers-9.0 branch from fc67065 to c249afd Compare September 18, 2024 11:09
Jens Vannerum added 2 commits September 20, 2024 16:45
… this is only for buttons currently

(cherry picked from commit 2380d4e)
Copy link

github-actions bot commented Nov 8, 2024

Hi @jensvannerum,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@tdonohue
Copy link
Member

@jensvannerum : Is there any chance to get this PR (and the 8.x/7.x versions) updated soon, so that we might consider including them in 8.1 / 7.6.3? If not, no worries. Just noticing though that we previously ranked this high priority, and it'd be nice to therefore move forward quickly. If you have a chance, I'd be willing to give this a test/review once ready.

@tdonohue tdonohue requested a review from atarix83 January 23, 2025 15:46
@tdonohue
Copy link
Member

@jensvannerum : We talked about this in the Developers Meeting today. If you can find time to get the merge conflicts solved soon, then both @atarix83 and I are willing to test & review this in the hopes we can include it in 8.1 / 7.6.3

…r-disabled-elements-for-screen-readers-9.0
@jensvannerum
Copy link
Contributor Author

@tdonohue I fixed all conflicts for the PR (also for the 8.x and 7.x versions)

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @jensvannerum ! I gave this another review and test today. The code looks good, but I found a stray console.log we may want to remove (see below). I also verified this fixes #3249, and tested several other disabled buttons to verify this seems to be a global fix.

I also really appreciate the new lint rule to enforce this. That'll make it so much easier to ensure we don't accidentally forget to disable buttons using dsBtnDisabled.

I think this looks ready to merge, but I'd appreciate it if we can remove the console.log. I'll also give @atarix83 until at least the end of day on Monday to give it a final review (if he has time).

@jensvannerum jensvannerum force-pushed the w2p-117544_support-for-disabled-elements-for-screen-readers-9.0 branch from b04ab03 to 920edef Compare January 27, 2025 09:20
@jensvannerum
Copy link
Contributor Author

Fixed last remaining issues in all versions of PR now @tdonohue, thanks for catching them (squashed commits).

Should be good to go now

@tdonohue tdonohue changed the title support for disabled elements for screen readers support for disabled buttons for screen readers Jan 28, 2025
@tdonohue
Copy link
Member

Thanks @jensvannerum ! This looks good to me now!

@tdonohue tdonohue merged commit d70fa8f into DSpace:main Jan 28, 2025
15 checks passed
@tdonohue tdonohue added this to the 9.0 milestone Jan 28, 2025
@tdonohue tdonohue removed the needs documentation PR is missing documentation. All new features and config changes require documentation. label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

The log in button is not fully accessible to users using a screen reader
2 participants