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(radio): radio with modern syntax is keyboard navigable #27530

Merged
merged 11 commits into from May 31, 2023
Merged

Conversation

thetaPC
Copy link
Contributor

@thetaPC thetaPC commented May 22, 2023

Issue number: resolves #27268


What is the current behavior?

When tabbing on a radio group (modern syntax), it focuses on the next radio option inside the radio group. It replicates the behavior of the up/down keys.

What is the new behavior?

  • When tabbing on a radio group (modern syntax), it focuses on the next radio option of the next radio group.

A spike ticket has been created to further investigate web accessibility and browser compatibility.

Does this introduce a breaking change?

  • Yes
  • No

Other information

N/A

@stackblitz
Copy link

stackblitz bot commented May 22, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions bot added the package: core @ionic/core package label May 22, 2023
@thetaPC thetaPC marked this pull request as ready for review May 25, 2023 16:35
@thetaPC thetaPC requested a review from a team as a code owner May 25, 2023 16:35
@liamdebeasi liamdebeasi self-requested a review May 25, 2023 17:23
@thetaPC thetaPC requested a review from liamdebeasi May 30, 2023 21:13
Copy link
Member

@liamdebeasi liamdebeasi left a comment

Choose a reason for hiding this comment

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

Good to go once my other comment has been addressed.

Can you make the commit title more descriptive too? Instead of "tab to the next radio group" maybe we say "fix(radio): radio with modern syntax is keyboard navigable"?

Great job!

@@ -135,7 +135,7 @@ export class Radio implements ComponentInterface {
ev.stopPropagation();
ev.preventDefault();

this.el.focus();
this.nativeInput.focus();
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this causes some issues with the legacy syntax just in Safari. Doing a Shift+Tab to get back to the previous radio group requires pressing Shift+Tab twice.

Suggested change
this.nativeInput.focus();
const element = this.legacyFormController.hasLegacyControl() ? this.el : this.nativeInput;
element.focus();

Let's keep focusing this.el only when in the legacy syntax.

@thetaPC thetaPC changed the title fix(radio): tab to the next radio group fix(radio): radio with modern syntax is keyboard navigable May 31, 2023
@thetaPC thetaPC added this pull request to the merge queue May 31, 2023
Merged via the queue into main with commit d87e692 May 31, 2023
45 checks passed
@thetaPC thetaPC deleted the FW-4155 branch May 31, 2023 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Radio group tab navigation is incorrect for modern form control syntax
2 participants