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

[CL-335][CL-336][CL-374] Announce toasts more consistently #13167

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

Conversation

vleague2
Copy link
Contributor

@vleague2 vleague2 commented Jan 30, 2025

🎟️ Tracking

CL-335
CL-336
CL-374

📔 Objective

This PR adds the following screenreader functionality to our toasts in all 3 clients:

  • Uses a custom toast container to set aria-live="polite" (which is ngx-toastr's default) as well as adding a role of status and aria-atomic to improve the consistency of toasts being announced. Some circumstances are not addressed by this fix, namely toasts not being announced when focus is lost.
  • Sets an additional aria-role="alert" on the toast when it is an error toast, which makes sure that screenreaders announce error messages

This PR also fixes a couple of issues related to Storybook:

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor

github-actions bot commented Jan 30, 2025

Logo
Checkmarx One – Scan Summary & Details5313953a-d277-48a8-ab94-4aa1f0fcfa16

New Issues (10)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Angular_Improper_Type_Pipe_Usage /libs/components/src/navigation/nav-divider.component.html: 1
detailsThe value used in open$ at /libs/components/src/navigation/nav-divider.component.html in line 1 may throw an exception with the pipe open$ in /libs...
Attack Vector
MEDIUM Client_Privacy_Violation /libs/tools/generator/components/src/credential-generator-history.component.html: 3
detailsMethod at line 3 of /libs/tools/generator/components/src/credential-generator-history.component.html sends user information outside the applicatio...
Attack Vector
MEDIUM Client_Privacy_Violation /libs/tools/generator/components/src/username-generator.component.html: 3
detailsMethod at line 3 of /libs/tools/generator/components/src/username-generator.component.html sends user information outside the application. This ma...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/password-generator-history.component.html: 11
detailsMethod at line 11 of /apps/web/src/app/tools/password-generator-history.component.html sends user information outside the application. This may co...
Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6
detailsMethod at line 6 of /libs/vault/src/components/password-history-view/password-history-view.component.html sends user information outside the appli...
Attack Vector
MEDIUM Client_Privacy_Violation /libs/vault/src/components/password-history-view/password-history-view.component.html: 6
detailsMethod at line 6 of /libs/vault/src/components/password-history-view/password-history-view.component.html sends user information outside the appli...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/password-generator-history.component.html: 11
detailsMethod at line 11 of /apps/web/src/app/tools/password-generator-history.component.html sends user information outside the application. This may co...
Attack Vector
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 17
detailsMethod Lambda at line 17 of /libs/components/src/color-password/color-password.component.ts sends user information outside the application. This ma...
Attack Vector
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 31
detailsMethod at line 31 of /libs/components/src/color-password/color-password.component.ts sends user information outside the application. This may cons...
Attack Vector
MEDIUM Client_Privacy_Violation /apps/desktop/src/app/tools/password-generator-history.component.html: 15
detailsMethod password_generator_history_component at line 15 of /apps/desktop/src/app/tools/password-generator-history.component.html sends user informat...
Attack Vector
Fixed Issues (2)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
HIGH CVE-2024-21538 Npm-cross-spawn-7.0.3
MEDIUM CVE-2024-55565 Npm-nanoid-3.3.7

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 35.06%. Comparing base (cbba1a6) to head (e0fbe9f).
Report is 61 commits behind head on main.

Files with missing lines Patch % Lines
.../components/src/toast/toast-container.component.ts 60.00% 2 Missing ⚠️
apps/desktop/src/app/app.component.ts 0.00% 1 Missing ⚠️
libs/components/src/toast/toastr.component.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13167      +/-   ##
==========================================
- Coverage   35.48%   35.06%   -0.43%     
==========================================
  Files        3007     3037      +30     
  Lines       90872    92727    +1855     
  Branches    16904    16888      -16     
==========================================
+ Hits        32250    32511     +261     
- Misses      56120    57753    +1633     
+ Partials     2502     2463      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vleague2 vleague2 marked this pull request as ready for review January 30, 2025 21:35
@vleague2 vleague2 requested review from willmartian and a team January 30, 2025 21:35
Copy link
Contributor

@willmartian willmartian left a comment

Choose a reason for hiding this comment

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

Bug solution looks good, but I would change the way we expose it to consumers of the lib. Issues with current approach:

  • An external dep / implementation detail is now exposed to the public API, here and here
    • This goes against a code style I want to follow for the CL, the facade pattern. I will add this to our CL code style docs.
  • We are duplicating some logic in each app component.

I think both of these issues are fixed by creating small container component: bit-toast-container. It could directly set ToastrService.overlayContainer with a reference to itself. That component could then be used in the app components.

@vleague2 vleague2 requested a review from willmartian February 5, 2025 15:30
willmartian
willmartian previously approved these changes Feb 5, 2025
Copy link
Contributor

@willmartian willmartian left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Do we need to add <bit-toast-container> to any stories (I believe the toast story is already broken)? Do we want to document it?

Comment on lines +31 to +32
constructor(toastrService: ToastrService, toastPackage: ToastPackage) {
super(toastrService, toastPackage);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice find

@vleague2 vleague2 requested a review from willmartian February 5, 2025 20:12
willmartian
willmartian previously approved these changes Feb 5, 2025
Copy link
Contributor

@willmartian willmartian left a comment

Choose a reason for hiding this comment

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

Bunch of doc nits, otherwise LGTM

libs/components/src/toast/toast.mdx Outdated Show resolved Hide resolved
libs/components/src/toast/toast.mdx Outdated Show resolved Hide resolved
libs/components/src/toast/toast.mdx Outdated Show resolved Hide resolved
libs/components/src/toast/toast.mdx Outdated Show resolved Hide resolved
libs/components/src/toast/toast.mdx Outdated Show resolved Hide resolved
Comment on lines +31 to +32
constructor(toastrService: ToastrService, toastPackage: ToastPackage) {
super(toastrService, toastPackage);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice find

libs/components/src/toast/toast.mdx Outdated Show resolved Hide resolved
Copy link
Contributor

@willmartian willmartian left a comment

Choose a reason for hiding this comment

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

Thanks!

@willmartian willmartian changed the title [CL-336] Announce toasts more consistently [CL-335][CL-336] Announce toasts more consistently Feb 6, 2025
@vleague2 vleague2 changed the title [CL-335][CL-336] Announce toasts more consistently [CL-335][CL-336][CL-374] Announce toasts more consistently Feb 6, 2025
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 this pull request may close these issues.

2 participants