Skip to content

fix(radio-group): enable unselect with spacebar #23194

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

Merged
merged 8 commits into from
Apr 21, 2021
Merged

fix(radio-group): enable unselect with spacebar #23194

merged 8 commits into from
Apr 21, 2021

Conversation

willmartian
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: resolves #22734

What is the new behavior?

  • Users can now unselect radio buttons with spacebar if allowEmptySelection is enabled on the radio group

Does this introduce a breaking change?

  • Yes
  • No

Sorry, something went wrong.

Unverified

This user has not yet uploaded their public signing key.

Unverified

This user has not yet uploaded their public signing key.
@willmartian willmartian requested a review from liamdebeasi April 15, 2021 14:59
@github-actions github-actions bot added the package: core @ionic/core package label Apr 15, 2021
Copy link
Contributor

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

Looks good, but we need to add a test for this before we can merge. I would prefer that we do a spec test if possible since they run a bit faster than E2E tests.

You can add a radio-group.spec.ts file in radio-group/test. See https://github.com/ionic-team/ionic-framework/blob/next/core/src/components/accordion/test/accordion.spec.ts for examples of how I write the tests. Also see https://stenciljs.com/docs/unit-testing for the Stencil testing API for newSpecPage.

We should add a test for when the user presses spacebar on a radio group that has allowEmptySelection and a test for when the user presses spacebar on a radio group that does not have allowEmptySelection.

Unverified

This user has not yet uploaded their public signing key.
@willmartian willmartian requested a review from liamdebeasi April 21, 2021 14:43
Comment on lines +19 to +21
const radioGroup = await page.find(`ion-radio#${radioButtonId} >>> input`);
const checked = await radioGroup.getProperty('checked');
return checked;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why we can't just look at the checked property on the host ion-radio element instead of diving into the shadow dom?

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed offline to keep test as is. checked is a state not a prop.

willmartian and others added 4 commits April 21, 2021 14:01
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
@willmartian willmartian merged commit 7139b3f into master Apr 21, 2021
@willmartian willmartian deleted the fix/22734 branch April 21, 2021 18:34
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: Cannot unselect radio button with space bar with allowEmptySelection true
2 participants