Skip to content

Commit e6cf649

Browse files
feat(select): remove role from action sheet interface (#31221)
Issue number: resolves internal Co-authored-by: Brandy Smith <brandyscarney@users.noreply.github.com>
1 parent 5d201bd commit e6cf649

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

BREAKING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,18 @@ The string form no longer behaves the same way. Because an HTML attribute coerce
127127

128128
<h4 id="version-9x-select">Select</h4>
129129

130+
**`ionChange` Only Fires When the Value Changes**
131+
130132
The `ionChange` event on `ion-select` now only fires when the selected value actually changes. Previously, the `alert` and `action-sheet` interfaces emitted `ionChange` every time the overlay was confirmed, even when the user chose the option that was already selected. This aligns the `alert` and `action-sheet` interfaces with the existing behavior of the `popover` and `modal` interfaces, and with the documented contract of `ionChange`.
131133

132134
Apps that relied on `ionChange` firing on every confirmation (for example, to detect overlay dismissal without a value change) should listen for `ionDismiss` instead, or use the `didDismiss` event on the underlying alert or action sheet.
133135

136+
**Action Sheet Interface `selected` Role Removed**
137+
138+
When using `interface="action-sheet"`, `ion-select` no longer assigns the `selected` role to the action sheet button for the currently selected option. This aligns the `action-sheet` interface with the `alert`, `popover`, and `modal` interfaces, none of which assign this role. This does not change the selected option's styling.
139+
140+
Previously, the `selected` role was assigned only to the option matching the select's current value. Because the dismiss role mirrors the tapped button, this surfaced in just one case: re-selecting the already-selected option dismissed the action sheet with `role: "selected"` in `ionActionSheetDidDismiss`. Tapping any other option changed the value and dismissed with `role: ""`. Now that the role is no longer assigned, both cases dismiss with `role: undefined`. Apps that inspected this role to detect that a value was chosen, such as reading `role` from the underlying action sheet's `onDidDismiss` result, should listen for `ion-select`'s `ionChange` event instead, which emits the selected value when the selection changes.
141+
134142
<h2 id="version-9x-framework-specific">Framework Specific</h2>
135143

136144
<h4 id="version-9x-angular">Angular</h4>

core/src/components/select/select.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,6 @@ export class Select implements ComponentInterface {
595595
const isSelected = isOptionSelected(selectValue, value, this.compareWith);
596596

597597
return {
598-
role: isSelected ? 'selected' : '',
599598
text: option.textContent,
600599
cssClass: optClass,
601600
handler: () => {

0 commit comments

Comments
 (0)