Skip to content

fix(radio): radio with modern syntax is keyboard navigable - #27530

Merged
thetaPC merged 11 commits into
mainfrom
FW-4155
May 31, 2023
Merged

thetaPC merged 11 commits into
mainfrom
FW-4155

Conversation

@thetaPC

@thetaPC thetaPC commented May 22, 2023 •

Copy link
Copy Markdown
Contributor

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

@bolt-new-by-stackblitz

Copy link
Copy Markdown

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
Comment thread core/src/components/radio/radio.tsx Resolved
@thetaPC
thetaPC requested a review from liamdebeasi May 30, 2023 21:13

@liamdebeasi liamdebeasi left a comment

Copy link
Copy Markdown
Contributor

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!

Comment thread core/src/components/radio/radio.tsx Outdated
ev.preventDefault();

this.el.focus();
this.nativeInput.focus();

Copy link
Copy Markdown
Contributor

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
@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