-
Notifications
You must be signed in to change notification settings - Fork 394
fix: (CXSPA-9010) Previous field error message read. #20071
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
Conversation
StanislavSukhanov
commented
Mar 12, 2025
- closes: https://jira.tools.sap/browse/CXSPA-9010
spartacus
|
Project |
spartacus
|
Branch Review |
feature/CXSPA-9010-previous-error-message-is-read-to-user
|
Run status |
|
Run duration | 04m 38s |
Commit |
|
Committer | Stanislav Sukhanov |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
4
|
|
0
|
|
0
|
|
118
|
View all changes introduced in this branch ↗︎ |
projects/core/src/features-config/feature-toggles/config/feature-toggles.ts
Outdated
Show resolved
Hide resolved
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.ts
Outdated
Show resolved
Hide resolved
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.ts
Outdated
Show resolved
Hide resolved
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.ts
Outdated
Show resolved
Hide resolved
e65e7fe
to
9aa51c5
Compare
@@ -35,13 +38,24 @@ import { map, startWith } from 'rxjs/operators'; | |||
selector: 'cx-form-errors', | |||
templateUrl: './form-errors.component.html', | |||
changeDetection: ChangeDetectionStrategy.OnPush, | |||
host: { |
There was a problem hiding this comment.
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 @HostBinding
s for these attributes like you did for attr.role
? I think it could be easier to understand and modify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, personally, using host in the component decorator is more readable.
https://angular.dev/guide/components/host-elements
here we have decorators listed as 'alternatively'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is completely reasonable point. I was just confused seeing both. I think its better to be consistent with whichever was there first just in my opinion.
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.ts
Outdated
Show resolved
Hide resolved
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.ts
Show resolved
Hide resolved
* code review fixes; * closes: https://jira.tools.sap/browse/CXSPA-9010
* code review fixes; * closes: https://jira.tools.sap/browse/CXSPA-9010
* code review fixes; * closes: https://jira.tools.sap/browse/CXSPA-9010
64fafc9
to
079d4b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also unit test the form errors component since for the aria-live
attribute and the ngDoCheck
as the logic become more complex.
? null | ||
: 'alert'; | ||
|
||
@HostBinding('attr.aria-live') get ariaLiveValue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive my ignorance on this one. Is the get ariaLiveValue()
a real method? How is it working if so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not at all, the reason it was set a a method was because it wasn't working in conjunction with a signal I've previously used. let me correct it
if (!this.featureConfigService.isEnabled( | ||
'a11yImprovedErrorMessage' | ||
)) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this override any preset aria-live
value to null
? Or its ok because we don't set it to anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is interesting thing. Let me check it out.
Initial intent was to ignore the aria-live, because if we do not have 'a11yImprovedErrorMessage'
enabled, the role of the host is being set to alert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it. now it's a bulletproof and doesnt ignore the aria-live attribute if it's being set from outside
* code review fixes; * closes: https://jira.tools.sap/browse/CXSPA-9010
Merge Checks Failed
|
* code review fixes; * closes: https://jira.tools.sap/browse/CXSPA-9010
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Lets just add the unit tests for making sure aria-live is correctly set now on the form errors component.
* add unit tests; * closes: https://jira.tools.sap/browse/CXSPA-9010
Merge Checks Failed
|
projects/storefrontlib/shared/components/form/form-errors/form-errors.component.spec.ts
Show resolved
Hide resolved
* add unit tests; * closes: https://jira.tools.sap/browse/CXSPA-9010