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 settings page #3613

Open
wants to merge 47 commits into
base: main
Choose a base branch
from

Conversation

AAwouters
Copy link
Contributor

@AAwouters AAwouters commented Nov 6, 2024

References

Fixes point 3 of #1191: "Content visually appears and disappears with no ability to adjust timing."

Description

This PR adds the 'Accessibility settings' page where a user can configure accessibility settings. This page can be found either through the 'Accessibility settings' link in the footer, or through the link on the profile page. The settings are stored in a cookie when the user is not authorized and are stored in a metadata field (see backend PR) when the user is authenticated.

Instructions for Reviewers

Access the page through one of the mentioned links, or directly at /info/accessibility. Currently only two settings are available: notification time-out and live region time-out. Functionality of the notification time-out is the easiest to verify. Set a new value and click the 'Save accessibility settings` button. A notification will appear mentioning whether the changes are saved locally (cookie) or on the user profile (metadata) and this notification will stay as long as configured.
Live region time-out can be verified by making the live region visible. (see #3337)

List of changes in this PR:

  • Adds the accessibility-settings component and service
  • Adds links to the 'Accessibility settings' page to the footer and profile page.
  • Notifications added to the notifications-board will have the user-configured time-out (if set by the user).
  • Messages added to the live-region will have the user-configured time-out (if set by the user).

Checklist

  • 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 npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run 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.

…-main

# Conflicts:
#	src/app/core/auth/auth.service.ts
#	src/app/info/info-routing-paths.ts
#	src/app/info/info-routing.module.ts
#	src/app/info/info.module.ts
#	src/app/shared/live-region/live-region.service.spec.ts
#	src/app/shared/live-region/live-region.service.ts
#	src/app/shared/notifications/notifications-board/notifications-board.component.spec.ts
#	src/app/shared/notifications/notifications-board/notifications-board.component.ts
#	src/config/app-config.interface.ts
#	src/config/default-app-config.ts
@AAwouters AAwouters force-pushed the accessibility-settings-main branch from 12fa618 to 3422ec7 Compare November 25, 2024 11:10
@nwoodward
Copy link
Contributor

Hi @AAwouters. Thank you for this PR. Overall, it looks really good. I tested it locally, and I'm having a problem with the Accessibility Settings form, both as an anonymous user and when I'm logged in. It happens on Firefox and Chrome.

When I change the "Hide notifications automatically" setting to off and click "Save accessibility settings" the green "Successfully saved settings..." notification doesn't go away until I click on the 'X'. That isn't a big problem, but once I change that setting then I can never change it back to on. Every time I do the setting returns to off, even though the green "Successfully saved settings" notification appears.

However, I am able to change the Notification and Live region timeouts successfully. The green "Successfully saved settings..." notification appears and disappears on its own. Also, clicking on "Reset accessibility settings" works well. And the green "Successfully reset settings" notification goes away after a few seconds. So I think the problem is only with the option to hide notifications automatically.

Screenshot 2024-12-19 at 11 10 34 AM Screenshot 2024-12-19 at 11 13 37 AM

…-main

# Conflicts:
#	src/app/accessibility/accessibility-settings.service.spec.ts
…s-main

# Conflicts:
#	src/app/profile-page/profile-page.component.html
#	src/app/profile-page/profile-page.component.ts
#	src/app/shared/notifications/notifications-board/notifications-board.component.spec.ts
#	src/app/shared/notifications/notifications-board/notifications-board.component.ts
#	src/themes/custom/app/profile-page/profile-page.component.ts
@AAwouters
Copy link
Contributor Author

@nwoodward

When I change the "Hide notifications automatically" setting to off and click "Save accessibility settings" the green "Successfully saved settings..." notification doesn't go away until I click on the 'X'.

Yes. When you disable automatic notification hiding, notifications won't hide/'go away' automatically. Maybe I misunderstood you but is that not exactly the expected behavior?

once I change that setting then I can never change it back to on. Every time I do the setting returns to off, even though the green "Successfully saved settings" notification appears.

Right. That was a small oversight on my part. It should be fixed now.

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.

@AAwouters : Thanks for this PR. Overall, the feature works, but I've run into a few bugs and areas for improvement.

  1. If I open the "Accessibility settings", leave the defaults and click "Save accessibility settings" button, I see an error in my Browser's DevTools console. This same error also appears if you try to change the time outs while anonymous.
TypeError: Cannot read properties of undefined (reading 'cookieExpirationDuration')
  • I'm running the UI in production mode: npm run build:prod; npm run serve:ssr
  • Do not login (stay anonymous)
  • Go to the "Accessibility Settings" page
  • Click the "Save Accessibility settings" button immediately. Or try to change one of the two timeouts (without touching the toggle).
  • In your browser's DevTools console, you'll see the error.
  1. Both of the time-outs can be set to a negative number, which doesn't make sense. I'd recommend we only allow a minimum of 1 or zero.

  2. If you open the Accessibility Settings and immediately click the up or down arrow next to the default time outs, you'll jump to -1 or 1. This is odd, especially for the "Live region time out", which starts at 30, but if you click the "up" arrow on the field, it goes to 1.

  3. I'm not a fan of the current display. I think we should change the labels to say "Notification time out (in seconds)" and "ARIA live region time out (in seconds)" as those are more accessible. Having the word "Seconds" appear after the input field will not make sense to screen readers. I also have a recommendation for renaming the "Hide notifications automatically" label (see comments inline below)

accessibility-settings

I also have some general suggestions inline below. Most of it is just text change suggestions.

@artlowel
Copy link
Member

@tdonohue Heads up: while I agree with your feedback. I should warn you that we're already quite a ways above the 100 hours that were the combined estimate on the original tickets (#1191, #1270 and #3154). Among other things because a separate accessibility settings page wasn't planned when we started. We're currently at 172 hours, and still have to start on the Orejime integration

…-main

# Conflicts:
#	src/app/accessibility/accessibility-settings.service.spec.ts
#	src/app/accessibility/accessibility-settings.service.ts
#	src/app/info/accessibility-settings/accessibility-settings.component.spec.ts
#	src/app/info/accessibility-settings/accessibility-settings.component.ts
#	src/app/shared/cookies/klaro-configuration.ts
#	src/assets/i18n/en.json5
@tdonohue
Copy link
Member

@artlowel : Thanks for letting us know. Please also try to remember to ping @hostle83 on any updates of estimates.

Could we have a fresh estimate then for how much time it anticipated for this entire effort? I know @hostle83 is trying to keep track of how much money is left in our fund for fixing accessibility issues. So, a new total estimate would be helpful for fund tracking purposes.

@artlowel
Copy link
Member

@tdonohue @hostle83 It should be doable in 185 hours total

@hostle83
Copy link

@tdonohue @hostle83 It should be doable in 185 hours total

Thank you, @artlowel!

@AAwouters
Copy link
Contributor Author

I've processed your feedback @tdonohue .

If I open the "Accessibility settings", leave the defaults and click "Save accessibility settings" button, I see an error in my Browser's DevTools console.

I was not able to reproduce this issue. cookieExpirationDuration is a configuration property so is it possible that the accessibility configuration somehow is undefined in your configuration?
I did make a small change to how that value is retrieved (moved from using environment directly to injecting APP_CONFIG).

Both of the time-outs can be set to a negative number, which doesn't make sense. I'd recommend we only allow a minimum of 1 or zero.

I initially wanted to avoid validation as it's a fairly simple form, but I agree that being able to enter negative values does not make sense.

If you open the Accessibility Settings and immediately click the up or down arrow next to the default time outs, you'll jump to -1 or 1. This is odd, especially for the "Live region time out", which starts at 30, but if you click the "up" arrow on the field, it goes to 1.

The reason for this is that those numbers were placeholders based on the default values and not actual values in the form.
As there is no actual value in the input field, it starts at 1 or -1 depending on which arrow you click.

The reason I used those placeholders instead of filling the form with the default values is because the behavior is slightly different for notifications.
The time-out for a notification can be set upon creation of the notification, in case no time-out is provided the default is used.
With the addition of the accessibility settings, three cases are possible:

  • Notification created without time out & no user-defined time out: Default time out is used.
  • Notification created with time out & no user-defined time out: Provided time out is used.
  • Notification created & there is a user-defined time out: user-defined time out is always used.

This means that when the default is pre-filled in the form and the user saves the form without making changes, the user might have changed the behavior without realising.
I suppose this is not that big of a deal as then all notifications will have the same time out.
It might even be possible that not a single notification is created with a different time out, but I did not check.

With the validation, empty fields are no longer possible so now the fields are filled with the default values (if there are no user-configured values yet).

e2e tests

With the addition of a new (optional) cookie, there are some issues with the e2e tests.
The cookie window sometimes covers elements such as buttons which causes the tests to fail.
For the main branch I've managed to fix the tests by simply clicking the 'accept' button of the cookie window in the necessary places.

For the 7_x and 8_x branches this approach does not seem to work.
It looks like the cookies are not cleared across tests so when a future test also attempts to click that same button, it fails to do so as it no longer exists.

Keep in mind that when logged in a different cookie is used based on the userId so three cookies are necessary: one for anonymous users, one for the admin user and one for the submitter user.
I've tried lots of things such as clearing and setting the cookies before each test, but I've had no luck so far.

@artlowel artlowel requested a review from tdonohue February 28, 2025 11:37
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.

@AAwouters : Thanks for the updates. I think this looks much better and is working well. I just have a few minor suggestions inline on how to cleanup the e2e tests (and fix those for 7.x and 8.x) and a few other minor things.

UPDATE: I've also noticed I'm getting an SSR error when I login now which seems related to the new Orejime Accessibility settings. Here's how to reproduce it:

  1. First, I'm running in production mode: npm run build:prod; npm run serve:ssr. Keep an eye on the commandline where you run npm run serve:ssr as this is where the SSR error will apper.
  2. Now, if you login, you'll see an SSR error similar to this on the commandline:
GET /reload/1740776418071?redirect=%2Finfo%2Faccessibility 200 465.058 ms - -
ERROR Error [NullInjectorError]: R3InjectorError(Standalone[RootComponent2])[LiveRegionService2 -> LiveRegionService2 -> AccessibilitySettingsService2 -> OrejimeService2 -> OrejimeService2]:
  NullInjectorError: No provider for OrejimeService2!

Once these minor things are cleaned up, I'd be +1 this PR. Thanks!

@@ -1,6 +1,9 @@
beforeEach(() => {
cy.visit('/collections/create?parent='.concat(Cypress.env('DSPACE_TEST_COMMUNITY')));
cy.loginViaForm(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));

// Accept all cookies to make sure cookie window does not block other elements
cy.get('.orejime-Button--save').click();
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to remove all these clicks that you've added to Orejime if you just update the default orejime-anonymous cookie defined here: https://github.com/DSpace/dspace-angular/blob/main/cypress/support/e2e.ts#L59

The purpose of adding that Cookie before every test is to ensure the Orejime window doesn't popup at all. If that cookie is set with all the proper settings, then the Orejime window shouldn't appear.

My guess is that since you added a new accessibility section to Orejime, you may need to add it to the Orejime cookie as well.

This same approach should also work for 7.x and 8.x branches, except they use Klaro instead and therefore define a default Klaro cookie in that same e2e.ts file for Cypress.


"info.accessibility-settings.liveRegionTimeOut.label": "ARIA Live region time out (in seconds)",

"info.accessibility-settings.liveRegionTimeOut.hint": "The duration after which a message in the ARIA live region disappears. ARIA live regions are not visible on the page, but proivde announcements of notifications (or other actions) to screen readers.",
Copy link
Member

Choose a reason for hiding this comment

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

Small typo here that I just noticed. In the second sentence "proivde" should be "provide".

@@ -80,6 +80,10 @@ <h5 class="text-uppercase">Footer Content</h5>
<a class="btn text-white"
routerLink="info/feedback">{{ 'footer.link.feedback' | translate}}</a>
</li>
<li>
<a class="text-white"
routerLink="info/accessibility">{{ 'footer.link.accessibility' | translate }}</a>
Copy link
Member

Choose a reason for hiding this comment

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

I think we should move this link next to the "Cookie Settings" in order to keep the two settings together. So, I'd propose the footer list these links in this ordering...

"Cookie settings" "Accessibility settings" "Privacy Policy" "End User Agreement", "Send Feedback"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 Under Review
Development

Successfully merging this pull request may close these issues.

5 participants