Skip to content

bug: ion-select with action-sheet interface and header focuses the previous item of the selected option #30480

@crazyserver

Description

@crazyserver
Contributor

Prerequisites

  • I have read the Contributing Guidelines.
    I agree to follow the Code of Conduct.
    I have searched for existing issues that already report this problem, without success.

Ionic Framework Version

v8.x

Current Behavior

With the following ion-select:

<ion-select
  aria-label="Fruit"
  interface="action-sheet"
  value="oranges"
  placeholder="Select fruit"
  [interfaceOptions]="{ header: 'Header' }"
>
  <ion-select-option value="apples">Apples</ion-select-option>
  <ion-select-option value="oranges">Oranges</ion-select-option>
  <ion-select-option value="bananas">Bananas</ion-select-option>
</ion-select>

When the action sheet is opened, the focused element with "ion-focused" class is the previous of the one that is selected.
On the code it searches the index of the selected item but then it uses nth-child to select it that takes into account the header of the action sheet.

A workaround is to remove the header.

Expected Behavior

The selected element is the one focused.

Steps to Reproduce

  1. Click on the select to open it
  2. See that "Apples" is highlighted instead of "Oranges"

Code Reproduction URL

https://stackblitz.com/edit/f6jtmmrf

Ionic Info

Ionic:

Ionic CLI : 7.2.1 (/Users/pau/.nvm/versions/node/v20.18.1/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 8.5.0
@angular-devkit/build-angular : 17.3.13
@angular-devkit/schematics : 17.3.13
@angular/cli : 17.3.13
@ionic/angular-toolkit : 11.0.1

Cordova:

Cordova CLI : 12.0.0 (cordova-lib@12.0.2)
Cordova Platforms : android 14.0.0, ios 7.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, (and 16 other plugins)

Utility:

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

System:

ios-sim : 8.0.2
NodeJS : v20.18.1 (/Users/pau/.nvm/versions/node/v20.18.1/bin/node)
npm : 10.8.2
OS : macOS Unknown
Xcode : Xcode 16.4 Build version 16F6

But I've tested in ionic 8.6.1 also.

Additional Information

No response

Activity

added a commit that references this issue on Jun 12, 2025
changed the title [-]bug: ion-select with header on interface options focus the previous item of the selected on[/-] [+]bug: ion-select with action-sheet interface and header focuses the previous item of the selected option[/+] on Jun 30, 2025
added a commit that references this issue on Jul 1, 2025
80a111c
ionitron-bot

ionitron-bot commented on Jul 31, 2025

@ionitron-bot

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.

locked and limited conversation to collaborators on Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @crazyserver@brandyscarney

      Issue actions

        bug: ion-select with action-sheet interface and header focuses the previous item of the selected option · Issue #30480 · ionic-team/ionic-framework