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

fix: (CXSPA-9010) Previous field error message read. #20071

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

StanislavSukhanov
Copy link
Contributor

@StanislavSukhanov StanislavSukhanov requested review from a team as code owners March 12, 2025 10:14
@github-actions github-actions bot marked this pull request as draft March 12, 2025 10:14
@StanislavSukhanov StanislavSukhanov marked this pull request as ready for review March 12, 2025 10:25
@StanislavSukhanov StanislavSukhanov self-assigned this Mar 12, 2025
Copy link

cypress bot commented Mar 12, 2025

spartacus    Run #47414

Run Properties:  status check passed Passed #47414  •  git commit e4725d5f44 ℹ️: Merge 9aa51c5cc1b0d6fc5f2635694f9f300b9955d2b9 into 5ea9821a4043ee580d9f4751f766...
Project spartacus
Branch Review feature/CXSPA-9010-previous-error-message-is-read-to-user
Run status status check passed Passed #47414
Run duration 04m 38s
Commit git commit e4725d5f44 ℹ️: Merge 9aa51c5cc1b0d6fc5f2635694f9f300b9955d2b9 into 5ea9821a4043ee580d9f4751f766...
Committer Stanislav Sukhanov
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 4
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 118
View all changes introduced in this branch ↗︎

Pio-Bar
Pio-Bar previously approved these changes Mar 12, 2025
@@ -1074,6 +1080,7 @@ export const defaultFeatureToggles: Required<FeatureTogglesInterface> = {
a11yStoreFinderAlerts: true,
a11yStoreFinderLabel: false,
a11yFormErrorMuteIcon: true,
a11yImprovedErrorMessage: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should introduce this as false by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right! Thanks a lot for noticing.

@@ -40,8 +42,22 @@ import { map, startWith } from 'rxjs/operators';
export class FormErrorsComponent implements DoCheck {
private featureConfigService = inject(FeatureConfigService);

private elementRef = inject(ElementRef);
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets use protected here.

constructor(protected ChangeDetectionRef: ChangeDetectorRef) {
useFeatureStyles('a11yFormErrorMuteIcon');
if (this.featureConfigService.isEnabled('a11yImprovedErrorMessage')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We could move this logic into its own method just to be a little tidier.

if (!ariaLive) {
// If no aria-live value is set add 'polite' as a default. This is preferred over setting
// role='alert' so that screen readers do not interrupt the current task to read this aloud.
this.elementRef.nativeElement.setAttribute('aria-live', 'polite');
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be careful with DOM manipulation on page instantiation because it can cause issues with SSR and hydration. Is it possible to set the attribute using an Angular-friendly method (eg. template, input value)?
https://angular.dev/guide/hydration#direct-dom-manipulation

@StanislavSukhanov StanislavSukhanov force-pushed the feature/CXSPA-9010-previous-error-message-is-read-to-user branch from e65e7fe to 9aa51c5 Compare March 25, 2025 10:08
@github-actions github-actions bot marked this pull request as draft March 25, 2025 10:09
@StanislavSukhanov StanislavSukhanov marked this pull request as ready for review March 25, 2025 10:10
@@ -35,13 +38,24 @@ import { map, startWith } from 'rxjs/operators';
selector: 'cx-form-errors',
templateUrl: './form-errors.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we could use @HostBindings for these attributes like you did for attr.role? I think it could be easier to understand and modify.

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.

3 participants