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

bug: ion-picker allows selection of disabled options between enabled options #26840

Closed
4 of 8 tasks
austinrzg opened this issue Feb 21, 2023 · 3 comments
Closed
4 of 8 tasks
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@austinrzg
Copy link

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • v7.x
  • Nightly

Current Behavior

When using an ion-picker with a list of options that begins with 1+ enabled, contains 1+ disabled options in the middle, then ends with 1+ enabled options, the selector doesn't correctly auto-select an enabled option. Further the selector allows the user to select a disabled option.

Expected Behavior

Users should not be able to select a disabled PickerColumnOption.

PickerColumn should auto-select a valid option if the user attempts to choose a disabled option.

Steps to Reproduce

  1. Create a simple ion-picker with a set of options - recommend 7 options to easily see the issue.
  2. Set the options as follows:
  • 0: disabled = false
  • 1: disabled = false
  • 2: disabled = true
  • 3: disabled = true
  • 4: disabled = true
  • 5: disabled = false
  • 6: disabled = 6
  1. Attempt to select a disabled option.

*Note, you may need to adjust the CSS for .picker-opt-disabled in order to see the disabled options more easily.

Code Reproduction URL

https://github.com/austinrzg/angular-fqvgd8

Ionic Info

Ionic:

Ionic CLI : 5.4.16

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v16.18.1
npm : 8.1.2
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Feb 21, 2023
@averyjohnston averyjohnston self-assigned this Feb 22, 2023
@averyjohnston
Copy link
Contributor

Thank you for the issue, I'm able to replicate this. Dragging the picker column with the mouse allows you to select the disabled items. It seems the number of items or columns doesn't matter, as long as there is at least one enabled item on both sides of the disabled item(s).

When using items like this:

  1. Enabled
  2. Disabled
  3. Enabled
  4. Disabled

... item 2 is selectable, but not item 4.

I'm able to replicate it in core, meaning it likely happens in all frameworks. It also happens with both controller pickers, and the upcoming inline pickers feature.

It looks like the best workaround is to rearrange things to place all disabled items at the end of the column.

@averyjohnston averyjohnston changed the title bug: ion-picker doesn't support disabled options between enabled options bug: ion-picker allows selection of disabled options between enabled options Feb 22, 2023
@averyjohnston averyjohnston added package: core @ionic/core package type: bug a confirmed bug report labels Feb 22, 2023
@averyjohnston averyjohnston removed their assignment Feb 22, 2023
liamdebeasi added a commit that referenced this issue Dec 13, 2023
Issue number: resolves #24905, resolves #26840, resolves #15710

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

The current picker is only displayed as an overlay which makes it
impossible to use inline with the rest of the application. Additionally,
there are several bugs and missing features. For example, it is
impossible to know when the value of the picker column has changed using
public APIs. This is valuable for updating other columns in response to
that data.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Introduces `ion-picker` as an inline wheel picker component. The
overlay picker is still available using `ion-picker-legacy`.
- The implementation of this component resolves linked bugs. It also
resolves linked features by exposing an `ionChange` event for developers
to listen for.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev-build: `7.5.8-dev.11702398696.1ab62ea9`

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Shawn Taylor <[email protected]>
Co-authored-by: Maria Hutt <[email protected]>
Co-authored-by: Amanda Johnston <[email protected]>
Co-authored-by: Sean Perkins <[email protected]>
Co-authored-by: Brandy Carney <[email protected]>
@liamdebeasi
Copy link
Contributor

Thanks for the request. In Ionic 8 we are adding a new inline picker which resolves this issue. The work required to add this was completed in #28689, so I am going to close this.

Copy link

ionitron-bot bot commented Jan 12, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

3 participants