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: Fix Radio Group Accessibility for core and platform and code improvement #3036

Merged
merged 8 commits into from
Sep 4, 2020

Conversation

DeepakSap14
Copy link
Contributor

@DeepakSap14 DeepakSap14 commented Aug 17, 2020

Please provide a link to the associated issue.

#2999

Please provide a brief summary of this pull request.

  1. Accessibility for Radio button and Radio Button Group.
  2. Includes core Radio Button accessibility fix
  3. improves code to remove bugs for radio group
  4. Includes unit tests for changes
  5. fix broken tests in platform
  6. stackblitz example fix

Please check whether the PR fulfills the following requirements

Documentation checklist:

  • Documentation Examples
  • Stackblitz works for all examples

@DeepakSap14 DeepakSap14 added accessibility use this label for any issue or enhancement related to screenreader/keyboard/etc support platform platform core Core library specific issues labels Aug 17, 2020
@DeepakSap14 DeepakSap14 self-assigned this Aug 17, 2020
@DeepakSap14 DeepakSap14 added this to In progress in Development via automation Aug 17, 2020
@DeepakSap14 DeepakSap14 moved this from In progress to Review in progress in Development Aug 17, 2020
@DeepakSap14 DeepakSap14 added this to In Review in Platform Development Aug 17, 2020
@netlify
Copy link

netlify bot commented Aug 17, 2020

Deploy preview for fundamental-ngx ready!

Built with commit 3a6ed5f

https://deploy-preview-3036--fundamental-ngx.netlify.app

@DeepakSap14 DeepakSap14 changed the title fix: (platform) Fix Radio Group Accessibility and code improvement [WIP] fix: (platform) Fix Radio Group Accessibility and code improvement Aug 17, 2020
Copy link
Member

@KevinOkamoto KevinOkamoto left a comment

Choose a reason for hiding this comment

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

See comment.

Copy link
Member

@KevinOkamoto KevinOkamoto left a 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.

@DeepakSap14 DeepakSap14 changed the title [WIP] fix: (platform) Fix Radio Group Accessibility and code improvement [WIP] fix: Fix Radio Group Accessibility for core and platform and code improvement Aug 20, 2020
Development automation moved this from Review in progress to Reviewer approved Aug 20, 2020
Platform Development automation moved this from In Review to Approved by Reviewer Aug 20, 2020
Development automation moved this from Reviewer approved to Review in progress Aug 21, 2020
@Input()
ariaLabel: string;
Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

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

Copy link
Contributor Author

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 = '';
Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

Platform Development automation moved this from Approved by Reviewer to In Review Aug 21, 2020
@DeepakSap14
Copy link
Contributor Author

This can be reviewed now.

@DeepakSap14 DeepakSap14 changed the title [WIP] fix: Fix Radio Group Accessibility for core and platform and code improvement fix: Fix Radio Group Accessibility for core and platform and code improvement Sep 1, 2020
@DeepakSap14 DeepakSap14 requested a review from a team September 1, 2020 07:34
Development automation moved this from Review in progress to Reviewer approved Sep 1, 2020
Platform Development automation moved this from In Review to Approved by Reviewer Sep 1, 2020
Copy link
Contributor

@JKMarkowski JKMarkowski left a 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 {
Copy link
Contributor

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

Copy link
Contributor Author

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"
Copy link
Contributor

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

Copy link
Contributor Author

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.

Comment on lines 147 to 149
this.contentRadioButtons.forEach((button) => {
button.stateType = this.status;
});
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Development automation moved this from Reviewer approved to Review in progress Sep 1, 2020
Platform Development automation moved this from Approved by Reviewer to In Review Sep 1, 2020
@DeepakSap14
Copy link
Contributor Author

Hello @DeepakSap14 I added some minor comments. I see you modified keyboard behaviour for radio group. Default one provided by browsers is not valid?

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.

@DeepakSap14 DeepakSap14 requested review from JKMarkowski and a team September 1, 2020 16:05
@DeepakSap14
Copy link
Contributor Author

@JKMarkowski please review the changes for your review.

Copy link
Contributor

@JKMarkowski JKMarkowski left a 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

Development automation moved this from Review in progress to Reviewer approved Sep 3, 2020
Platform Development automation moved this from In Review to Approved by Reviewer Sep 3, 2020
@DeepakSap14
Copy link
Contributor Author

corrected focus issue while page loading.
ran lint, test and build. all passing.

@DeepakSap14
Copy link
Contributor Author

Radio group focus works in Firefox.
In Chrome, this seems to be issue only when more than one Radio group present in adjacent manner.
will raise issue for that and address in different PR.

@DeepakSap14 DeepakSap14 merged commit 06cc3b8 into master Sep 4, 2020
Development automation moved this from Reviewer approved to Done Sep 4, 2020
@DeepakSap14 DeepakSap14 deleted the fix/radioA11y branch September 4, 2020 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility use this label for any issue or enhancement related to screenreader/keyboard/etc support core Core library specific issues platform platform
Projects
No open projects
Platform Development
  
Approved by Reviewer
Development

Successfully merging this pull request may close these issues.

None yet

4 participants