Skip to content

Conversation

@crazyserver
Copy link
Contributor

@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
@vercel
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! 🙂

Copy link
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@brandyscarney brandyscarney added this pull request to the merge queue Jul 1, 2025
Merged via the queue into ionic-team:main with commit 80a111c Jul 1, 2025
51 checks passed
@crazyserver crazyserver deleted the patch-2 branch July 1, 2025 20:24
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

3 participants