Skip to content

fix(select): focus the correct selected item #30481

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crazyserver
Copy link

@crazyserver crazyserver commented Jun 12, 2025

See #30480

Issue number: resolves #30480


What is the current behavior?

With the following ion-select:

<ion-select [(ngModel)]="selected" [interfaceOptions]="{header: 'header"> <ion-select-option *ngFor="let entry of entries" [value]="entry.value">{{ entry.label }}</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.

What is the new behavior?

  • The focused element on ion-select is the one that is selected.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@crazyserver crazyserver requested a review from a team as a code owner June 12, 2025 14:59
@crazyserver crazyserver requested a review from ShaneK June 12, 2025 14:59
Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2025 3:00pm

@github-actions github-actions bot added the package: core @ionic/core package label Jun 12, 2025
crazyserver added a commit to crazyserver/moodleapp that referenced this pull request Jun 12, 2025
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: ion-select with header on interface options focus the previous item of the selected on
1 participant