Skip to content

fix(select): focus the correct selected item in an action sheet interface with a header #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 3 commits into
base: main
Choose a base branch
from

Conversation

crazyserver
Copy link

@crazyserver crazyserver commented Jun 12, 2025

Issue number: resolves #30480


What is the current behavior?

When using a select component with the action-sheet interface, a header, and a default selected value, the action sheet opens with the wrong item focused. This happens because the focus logic uses nth-child to target the selected item, which incorrectly includes the header since it is a child element. As a result, the focus is shifted one item above the correct selection.

What is the new behavior?

  • Correctly focus the selected item when opening an action-sheet with a header from a select.
  • Adds e2e tests for verifying this behavior.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Preview

@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 30, 2025 9:09pm

@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
crazyserver added a commit to crazyserver/moodleapp that referenced this pull request Jun 25, 2025
@brandyscarney brandyscarney changed the title fix(select): focus the correct selected item fix(select): focus the correct selected item in an action sheet interface with a header Jun 30, 2025
Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! I added some tests to avoid a future regression but the fix looks good! 🙂

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 action-sheet interface and header focuses the previous item of the selected option
2 participants