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

refactor(): remove checked property in favor of parent value #19449

Merged
merged 32 commits into from
Jan 17, 2020

Conversation

manucorporat
Copy link
Contributor

@manucorporat manucorporat commented Sep 25, 2019

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?

Being able to set checked value on parent group and child elements has caused numerous issues in terms of deadlocking, inconsistent values, etc.

What is the new behavior?

Remove the "checked" properties from children. Developers should now set the value property on the parent element in order to indicate which item is selected.

Does this introduce a breaking change?

  • Yes
  • No

Breaking Changes

Selection Controls

The following components have been updated to remove the checked or selected properties:

  • Radio
  • Segment Button
  • Select

Developers should set the value property on the respective parent components in order to managed checked/selected status.

Segment Button

Old Usage

<ion-segment>
  <ion-segment-button>One</ion-segment-button>
  <ion-segment-button checked>Two</ion-segment-button>
  <ion-segment-button>Three</ion-segment-button>
</ion-segment>

New Usage

<ion-segment value="two">
  <ion-segment-button value="one">One</ion-segment-button>
  <ion-segment-button value="two">Two</ion-segment-button>
  <ion-segment-button value="three">Three</ion-segment-button>
</ion-segment>

Radio

  • The checked property has been removed. See Selection Controls for more information.
  • ion-radio must be used inside of an ion-radio-group, even if there is only one ion-radio.

Old Usage

<ion-radio checked>One</ion-radio>

<ion-radio-group>
  <ion-radio>One</ion-radio>
  <ion-radio checked>Two</ion-radio>
</ion-radio-group>

New Usage

<ion-radio-group value="one">
  <ion-radio value="one">One</ion-radio>
</ion-radio-group>

<ion-radio-group value="two">
  <ion-radio value="one">One</ion-radio>
  <ion-radio value="two">Two</ion-radio>
</ion-radio-group>

Select

Old Usage

<ion-select>
  <ion-select-option>One</ion-select-option>
  <ion-select-option selected>Two</ion-select-option>
</ion-select>

New Usage

<ion-select value="two">
  <ion-select-option value="one">One</ion-select-option>
  <ion-select-option value="two">Two</ion-select-option>
</ion-select>

@ionitron-bot ionitron-bot bot added package: angular @ionic/angular package package: core @ionic/core package labels Sep 25, 2019
@liamdebeasi liamdebeasi changed the title refactor(radio-group): single source of truth refactor(): remove checked property in favor of value Jan 16, 2020
@liamdebeasi liamdebeasi changed the title refactor(): remove checked property in favor of value refactor(): remove checked property in favor of parent value Jan 16, 2020
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
BREAKING.md Outdated Show resolved Hide resolved
liamdebeasi and others added 10 commits January 17, 2020 16:08
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
Co-Authored-By: Brandy Carney <brandyscarney@users.noreply.github.com>
@liamdebeasi liamdebeasi merged commit a5229d9 into master Jan 17, 2020
@liamdebeasi liamdebeasi deleted the fix-simple-radio-group branch January 17, 2020 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: core @ionic/core package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants