-
Notifications
You must be signed in to change notification settings - Fork 125
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: Fix Radio Group Accessibility for core and platform and code improvement #3036
Conversation
Deploy preview for fundamental-ngx ready! Built with commit 3a6ed5f |
b8de248
to
45b6d8a
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.
See comment.
libs/platform/src/lib/components/form/radio-group/radio/radio.component.html
Outdated
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.
I don't think fd-radio-button
has aria-label
, aria-labelledby
, etc. as property bindings.
libs/platform/src/lib/components/form/radio-group/radio/radio.component.html
Outdated
Show resolved
Hide resolved
@Input() | ||
ariaLabel: string; |
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.
Let's move this up as we already commented in the other PR2989
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.
Done
* Includes the Radio in the page tab sequence. | ||
*/ | ||
@Input() | ||
tabIndex = -1; |
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.
Just like my comment in the other PR .. for the tabindex
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.
tabindex for Radio button changes.
for selected radio it should be 0 and for not selected radios, it should be -1.
it will change dynamically once selection of choice changes.
So have to keep it as @input().
same is done in materials design implementation as well.
* take precedence so this may be omitted. | ||
*/ | ||
@Input('aria-label') | ||
ariaLabel = ''; |
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.
The same comment for ariaLabels like on the other places
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.
Done
* Includes the radio in the page tab sequence. | ||
*/ | ||
@Input() | ||
tabIndex: number; |
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.
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.
tabindex for Radio button changes.
for selected radio it should be 0 and for not selected radios, it should be -1.
it will change dynamically once selection of choice changes.
So have to keep it as @input().
same is done in materials design implementation as well.
89bba7a
to
db2b3fa
Compare
db2b3fa
to
f1d65ad
Compare
This can be reviewed now. |
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.
Hello @DeepakSap14 I added some minor comments. I see you modified keyboard behaviour for radio group. Default one provided by browsers is not valid?
@@ -159,9 +181,10 @@ export class RadioButtonComponent implements OnChanges, AfterViewInit, CssClassB | |||
} | |||
|
|||
/** @hidden */ | |||
labelClicked(): void { | |||
labelClicked(event: any): void { |
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.
Let's add typing any
=> MouseEvent
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.
Added MouseEvent and KeyboardEvent. list item is clicking Radio button on "keydown" event as well. so have to support "KeyboardEvent". have to modify list-item radioClicked() as well, to pass event.
Done.
@@ -4,11 +4,17 @@ | |||
[disabled]="disabled" | |||
[id]="id" | |||
[name]="name" | |||
[attr.tabIndex]="tabIndex" |
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 should be [attr.tabindex]="tabIndex"
, with lowercase
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.
Thanks.
corrected for checkbox and radio.
this.contentRadioButtons.forEach((button) => { | ||
button.stateType = this.status; | ||
}); |
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.
You can remove brackets and do it in 1 line
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.
Done
f1d65ad
to
bd24e97
Compare
keyboard arrow keys, by default is not supported in browsers like "firefox, safari, edge etc", only "chrome" is supporting default behaviour. so have to support it. |
@JKMarkowski please review the changes for your review. |
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.
Focus works weird there. There is no way to focus some of radio groups.
From core perspective everything works fine, so I I'll approve it
fix: initial implementation,known bugs
bd24e97
to
3a6ed5f
Compare
corrected focus issue while page loading. |
Radio group focus works in Firefox. |
Please provide a link to the associated issue.
#2999
Please provide a brief summary of this pull request.
Please check whether the PR fulfills the following requirements
https://github.com/SAP/fundamental-ngx/blob/master/CONTRIBUTING.md
https://github.com/SAP/fundamental-ngx/wiki/PR-Review-Checklist
Documentation checklist: