Skip to content

Commit ca01fe8

Browse files
authored
docs(core): ionChange will not emit from programmatically changing value (#29407)
Issue number: resolves ionic-team/ionic-docs#3588 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The documentation around `ionChange` not being emitted when programmatically changing the property associated to the "value" is either inconsistent or missing from certain components. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Adds the documentation to the missing components. - Makes the documentation consistent across components. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
1 parent 6e8bf49 commit ca01fe8

File tree

15 files changed

+71
-42
lines changed

15 files changed

+71
-42
lines changed

core/src/components.d.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4770,7 +4770,7 @@ declare namespace LocalJSX {
47704770
*/
47714771
"multiple"?: boolean;
47724772
/**
4773-
* Emitted when the value property has changed as a result of a user action such as a click. This event will not emit when programmatically setting the value property.
4773+
* Emitted when the value property has changed as a result of a user action such as a click. This event will not emit when programmatically setting the `value` property.
47744774
*/
47754775
"onIonChange"?: (event: IonAccordionGroupCustomEvent<AccordionGroupChangeEventDetail>) => void;
47764776
/**
@@ -5345,7 +5345,7 @@ declare namespace LocalJSX {
53455345
*/
53465346
"onIonBlur"?: (event: IonCheckboxCustomEvent<void>) => void;
53475347
/**
5348-
* Emitted when the checked property has changed as a result of a user action such as a click. This event will not emit when programmatically setting the checked property.
5348+
* Emitted when the checked property has changed as a result of a user action such as a click. This event will not emit when programmatically setting the `checked` property.
53495349
*/
53505350
"onIonChange"?: (event: IonCheckboxCustomEvent<CheckboxChangeEventDetail>) => void;
53515351
/**
@@ -5601,7 +5601,7 @@ declare namespace LocalJSX {
56015601
*/
56025602
"onIonCancel"?: (event: IonDatetimeCustomEvent<void>) => void;
56035603
/**
5604-
* Emitted when the value (selected date) has changed.
5604+
* Emitted when the value (selected date) has changed. This event will not emit when programmatically setting the `value` property.
56055605
*/
56065606
"onIonChange"?: (event: IonDatetimeCustomEvent<DatetimeChangeEventDetail>) => void;
56075607
/**
@@ -5971,7 +5971,7 @@ declare namespace LocalJSX {
59715971
*/
59725972
"onIonBlur"?: (event: IonInputCustomEvent<FocusEvent>) => void;
59735973
/**
5974-
* The `ionChange` event is fired when the user modifies the input's value. Unlike the `ionInput` event, the `ionChange` event is only fired when changes are committed, not as the user types. Depending on the way the users interacts with the element, the `ionChange` event fires at a different moment: - When the user commits the change explicitly (e.g. by selecting a date from a date picker for `<ion-input type="date">`, pressing the "Enter" key, etc.). - When the element loses focus after its value has changed: for elements where the user's interaction is typing.
5974+
* The `ionChange` event is fired when the user modifies the input's value. Unlike the `ionInput` event, the `ionChange` event is only fired when changes are committed, not as the user types. Depending on the way the users interacts with the element, the `ionChange` event fires at a different moment: - When the user commits the change explicitly (e.g. by selecting a date from a date picker for `<ion-input type="date">`, pressing the "Enter" key, etc.). - When the element loses focus after its value has changed: for elements where the user's interaction is typing. This event will not emit when programmatically setting the `value` property.
59755975
*/
59765976
"onIonChange"?: (event: IonInputCustomEvent<InputChangeEventDetail>) => void;
59775977
/**
@@ -6620,7 +6620,7 @@ declare namespace LocalJSX {
66206620
*/
66216621
"numericInput"?: boolean;
66226622
/**
6623-
* Emitted when the value has changed.
6623+
* Emitted when the value has changed. This event will not emit when programmatically setting the `value` property.
66246624
*/
66256625
"onIonChange"?: (event: IonPickerColumnCustomEvent<PickerColumnChangeEventDetail>) => void;
66266626
/**
@@ -6961,7 +6961,7 @@ declare namespace LocalJSX {
69616961
*/
69626962
"name"?: string;
69636963
/**
6964-
* Emitted when the value has changed.
6964+
* Emitted when the value has changed. This event will not emit when programmatically setting the `value` property.
69656965
*/
69666966
"onIonChange"?: (event: IonRadioGroupCustomEvent<RadioGroupChangeEventDetail>) => void;
69676967
/**
@@ -7023,7 +7023,7 @@ declare namespace LocalJSX {
70237023
*/
70247024
"onIonBlur"?: (event: IonRangeCustomEvent<void>) => void;
70257025
/**
7026-
* The `ionChange` event is fired for `<ion-range>` elements when the user modifies the element's value: - When the user releases the knob after dragging; - When the user moves the knob with keyboard arrows `ionChange` is not fired when the value is changed programmatically.
7026+
* The `ionChange` event is fired for `<ion-range>` elements when the user modifies the element's value: - When the user releases the knob after dragging; - When the user moves the knob with keyboard arrows This event will not emit when programmatically setting the `value` property.
70277027
*/
70287028
"onIonChange"?: (event: IonRangeCustomEvent<RangeChangeEventDetail>) => void;
70297029
/**
@@ -7324,7 +7324,7 @@ declare namespace LocalJSX {
73247324
*/
73257325
"onIonCancel"?: (event: IonSearchbarCustomEvent<void>) => void;
73267326
/**
7327-
* The `ionChange` event is fired for `<ion-searchbar>` elements when the user modifies the element's value. Unlike the `ionInput` event, the `ionChange` event is not necessarily fired for each alteration to an element's value. The `ionChange` event is fired when the value has been committed by the user. This can happen when the element loses focus or when the "Enter" key is pressed. `ionChange` can also fire when clicking the clear or cancel buttons.
7327+
* The `ionChange` event is fired for `<ion-searchbar>` elements when the user modifies the element's value. Unlike the `ionInput` event, the `ionChange` event is not necessarily fired for each alteration to an element's value. The `ionChange` event is fired when the value has been committed by the user. This can happen when the element loses focus or when the "Enter" key is pressed. `ionChange` can also fire when clicking the clear or cancel buttons. This event will not emit when programmatically setting the `value` property.
73287328
*/
73297329
"onIonChange"?: (event: IonSearchbarCustomEvent<SearchbarChangeEventDetail>) => void;
73307330
/**
@@ -7386,7 +7386,7 @@ declare namespace LocalJSX {
73867386
*/
73877387
"mode"?: "ios" | "md";
73887388
/**
7389-
* Emitted when the value property has changed and any dragging pointer has been released from `ion-segment`.
7389+
* Emitted when the value property has changed and any dragging pointer has been released from `ion-segment`. This event will not emit when programmatically setting the `value` property.
73907390
*/
73917391
"onIonChange"?: (event: IonSegmentCustomEvent<SegmentChangeEventDetail>) => void;
73927392
/**
@@ -7506,7 +7506,7 @@ declare namespace LocalJSX {
75067506
*/
75077507
"onIonCancel"?: (event: IonSelectCustomEvent<void>) => void;
75087508
/**
7509-
* Emitted when the value has changed.
7509+
* Emitted when the value has changed. This event will not emit when programmatically setting the `value` property.
75107510
*/
75117511
"onIonChange"?: (event: IonSelectCustomEvent<SelectChangeEventDetail>) => void;
75127512
/**
@@ -7809,7 +7809,7 @@ declare namespace LocalJSX {
78097809
*/
78107810
"onIonBlur"?: (event: IonTextareaCustomEvent<FocusEvent>) => void;
78117811
/**
7812-
* The `ionChange` event is fired when the user modifies the textarea's value. Unlike the `ionInput` event, the `ionChange` event is fired when the element loses focus after its value has been modified.
7812+
* The `ionChange` event is fired when the user modifies the textarea's value. Unlike the `ionInput` event, the `ionChange` event is fired when the element loses focus after its value has been modified. This event will not emit when programmatically setting the `value` property.
78137813
*/
78147814
"onIonChange"?: (event: IonTextareaCustomEvent<TextareaChangeEventDetail>) => void;
78157815
/**
@@ -8028,7 +8028,7 @@ declare namespace LocalJSX {
80288028
*/
80298029
"onIonBlur"?: (event: IonToggleCustomEvent<void>) => void;
80308030
/**
8031-
* Emitted when the user switches the toggle on or off. Does not emit when programmatically changing the value of the `checked` property.
8031+
* Emitted when the user switches the toggle on or off. This event will not emit when programmatically setting the `checked` property.
80328032
*/
80338033
"onIonChange"?: (event: IonToggleCustomEvent<ToggleChangeEventDetail>) => void;
80348034
/**

core/src/components/accordion-group/accordion-group.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ export class AccordionGroup implements ComponentInterface {
5959
@Prop() expand: 'compact' | 'inset' = 'compact';
6060

6161
/**
62-
* Emitted when the value property has changed
63-
* as a result of a user action such as a click.
64-
* This event will not emit when programmatically setting
65-
* the value property.
62+
* Emitted when the value property has changed as a result of a user action such as a click.
63+
*
64+
* This event will not emit when programmatically setting the `value` property.
6665
*/
6766
@Event() ionChange!: EventEmitter<AccordionGroupChangeEventDetail>;
6867

core/src/components/checkbox/checkbox.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ export class Checkbox implements ComponentInterface {
9797
@Prop() alignment: 'start' | 'center' = 'center';
9898

9999
/**
100-
* Emitted when the checked property has changed
101-
* as a result of a user action such as a click.
102-
* This event will not emit when programmatically
103-
* setting the checked property.
100+
* Emitted when the checked property has changed as a result of a user action such as a click.
101+
*
102+
* This event will not emit when programmatically setting the `checked` property.
104103
*/
105104
@Event() ionChange!: EventEmitter<CheckboxChangeEventDetail>;
106105

core/src/components/datetime/datetime.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ export class Datetime implements ComponentInterface {
477477

478478
/**
479479
* Emitted when the value (selected date) has changed.
480+
*
481+
* This event will not emit when programmatically setting the `value` property.
480482
*/
481483
@Event() ionChange!: EventEmitter<DatetimeChangeEventDetail>;
482484

core/src/components/input/input.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ export class Input implements ComponentInterface {
296296
* from a date picker for `<ion-input type="date">`, pressing the "Enter" key, etc.).
297297
* - When the element loses focus after its value has changed: for elements
298298
* where the user's interaction is typing.
299+
*
300+
* This event will not emit when programmatically setting the `value` property.
299301
*/
300302
@Event() ionChange!: EventEmitter<InputChangeEventDetail>;
301303

core/src/components/picker-column/picker-column.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export class PickerColumn implements ComponentInterface {
6666

6767
/**
6868
* Emitted when the value has changed.
69+
*
70+
* This event will not emit when programmatically setting the `value` property.
6971
*/
7072
@Event() ionChange!: EventEmitter<PickerColumnChangeEventDetail>;
7173

core/src/components/radio-group/radio-group.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export class RadioGroup implements ComponentInterface {
4747

4848
/**
4949
* Emitted when the value has changed.
50+
*
51+
* This event will not emit when programmatically setting the `value` property.
5052
*/
5153
@Event() ionChange!: EventEmitter<RadioGroupChangeEventDetail>;
5254

core/src/components/range/range.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export class Range implements ComponentInterface {
235235
* - When the user releases the knob after dragging;
236236
* - When the user moves the knob with keyboard arrows
237237
*
238-
* `ionChange` is not fired when the value is changed programmatically.
238+
* This event will not emit when programmatically setting the `value` property.
239239
*/
240240
@Event() ionChange!: EventEmitter<RangeChangeEventDetail>;
241241

core/src/components/searchbar/searchbar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ export class Searchbar implements ComponentInterface {
225225
* by the user. This can happen when the element loses focus or
226226
* when the "Enter" key is pressed. `ionChange` can also fire
227227
* when clicking the clear or cancel buttons.
228+
*
229+
* This event will not emit when programmatically setting the `value` property.
228230
*/
229231
@Event() ionChange!: EventEmitter<SearchbarChangeEventDetail>;
230232

core/src/components/segment/segment.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ export class Segment implements ComponentInterface {
9494
@Prop() selectOnFocus = false;
9595

9696
/**
97-
* Emitted when the value property has changed and any
98-
* dragging pointer has been released from `ion-segment`.
97+
* Emitted when the value property has changed and any dragging pointer has been released from `ion-segment`.
98+
*
99+
* This event will not emit when programmatically setting the `value` property.
99100
*/
100101
@Event() ionChange!: EventEmitter<SegmentChangeEventDetail>;
101102

core/src/components/select/select.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ export class Select implements ComponentInterface {
197197

198198
/**
199199
* Emitted when the value has changed.
200+
*
201+
* This event will not emit when programmatically setting the `value` property.
200202
*/
201203
@Event() ionChange!: EventEmitter<SelectChangeEventDetail>;
202204

core/src/components/textarea/textarea.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ export class Textarea implements ComponentInterface {
263263
* The `ionChange` event is fired when the user modifies the textarea's value.
264264
* Unlike the `ionInput` event, the `ionChange` event is fired when
265265
* the element loses focus after its value has been modified.
266+
*
267+
* This event will not emit when programmatically setting the `value` property.
266268
*/
267269
@Event() ionChange!: EventEmitter<TextareaChangeEventDetail>;
268270

core/src/components/toggle/toggle.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ export class Toggle implements ComponentInterface {
107107
@Prop() alignment: 'start' | 'center' = 'center';
108108

109109
/**
110-
* Emitted when the user switches the toggle on or off. Does not emit
111-
* when programmatically changing the value of the `checked` property.
110+
* Emitted when the user switches the toggle on or off.
111+
*
112+
* This event will not emit when programmatically setting the `checked` property.
112113
*/
113114
@Event() ionChange!: EventEmitter<ToggleChangeEventDetail>;
114115

packages/angular/src/directives/proxies.ts

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ import type { AccordionGroupChangeEventDetail as IIonAccordionGroupAccordionGrou
5353

5454
export declare interface IonAccordionGroup extends Components.IonAccordionGroup {
5555
/**
56-
* Emitted when the value property has changed
57-
as a result of a user action such as a click.
58-
This event will not emit when programmatically setting
59-
the value property.
56+
* Emitted when the value property has changed as a result of a user action such as a click.
57+
58+
This event will not emit when programmatically setting the `value` property.
6059
*/
6160
ionChange: EventEmitter<CustomEvent<IIonAccordionGroupAccordionGroupChangeEventDetail>>;
6261
}
@@ -530,10 +529,9 @@ import type { CheckboxChangeEventDetail as IIonCheckboxCheckboxChangeEventDetail
530529

531530
export declare interface IonCheckbox extends Components.IonCheckbox {
532531
/**
533-
* Emitted when the checked property has changed
534-
as a result of a user action such as a click.
535-
This event will not emit when programmatically
536-
setting the checked property.
532+
* Emitted when the checked property has changed as a result of a user action such as a click.
533+
534+
This event will not emit when programmatically setting the `checked` property.
537535
*/
538536
ionChange: EventEmitter<CustomEvent<IIonCheckboxCheckboxChangeEventDetail>>;
539537
/**
@@ -664,6 +662,8 @@ export declare interface IonDatetime extends Components.IonDatetime {
664662
ionCancel: EventEmitter<CustomEvent<void>>;
665663
/**
666664
* Emitted when the value (selected date) has changed.
665+
666+
This event will not emit when programmatically setting the `value` property.
667667
*/
668668
ionChange: EventEmitter<CustomEvent<IIonDatetimeDatetimeChangeEventDetail>>;
669669
/**
@@ -1001,6 +1001,8 @@ event fires at a different moment:
10011001
from a date picker for `<ion-input type="date">`, pressing the "Enter" key, etc.).
10021002
- When the element loses focus after its value has changed: for elements
10031003
where the user's interaction is typing.
1004+
1005+
This event will not emit when programmatically setting the `value` property.
10041006
*/
10051007
ionChange: EventEmitter<CustomEvent<IIonInputInputChangeEventDetail>>;
10061008
/**
@@ -1487,6 +1489,8 @@ import type { PickerColumnChangeEventDetail as IIonPickerColumnPickerColumnChang
14871489
export declare interface IonPickerColumn extends Components.IonPickerColumn {
14881490
/**
14891491
* Emitted when the value has changed.
1492+
1493+
This event will not emit when programmatically setting the `value` property.
14901494
*/
14911495
ionChange: EventEmitter<CustomEvent<IIonPickerColumnPickerColumnChangeEventDetail>>;
14921496
}
@@ -1656,6 +1660,8 @@ import type { RadioGroupChangeEventDetail as IIonRadioGroupRadioGroupChangeEvent
16561660
export declare interface IonRadioGroup extends Components.IonRadioGroup {
16571661
/**
16581662
* Emitted when the value has changed.
1663+
1664+
This event will not emit when programmatically setting the `value` property.
16591665
*/
16601666
ionChange: EventEmitter<CustomEvent<IIonRadioGroupRadioGroupChangeEventDetail>>;
16611667
}
@@ -1692,7 +1698,7 @@ modifies the element's value:
16921698
- When the user releases the knob after dragging;
16931699
- When the user moves the knob with keyboard arrows
16941700
1695-
`ionChange` is not fired when the value is changed programmatically.
1701+
This event will not emit when programmatically setting the `value` property.
16961702
*/
16971703
ionChange: EventEmitter<CustomEvent<IIonRangeRangeChangeEventDetail>>;
16981704
/**
@@ -1922,6 +1928,8 @@ The `ionChange` event is fired when the value has been committed
19221928
by the user. This can happen when the element loses focus or
19231929
when the "Enter" key is pressed. `ionChange` can also fire
19241930
when clicking the clear or cancel buttons.
1931+
1932+
This event will not emit when programmatically setting the `value` property.
19251933
*/
19261934
ionChange: EventEmitter<CustomEvent<IIonSearchbarSearchbarChangeEventDetail>>;
19271935
/**
@@ -1967,8 +1975,9 @@ import type { SegmentChangeEventDetail as IIonSegmentSegmentChangeEventDetail }
19671975

19681976
export declare interface IonSegment extends Components.IonSegment {
19691977
/**
1970-
* Emitted when the value property has changed and any
1971-
dragging pointer has been released from `ion-segment`.
1978+
* Emitted when the value property has changed and any dragging pointer has been released from `ion-segment`.
1979+
1980+
This event will not emit when programmatically setting the `value` property.
19721981
*/
19731982
ionChange: EventEmitter<CustomEvent<IIonSegmentSegmentChangeEventDetail>>;
19741983
}
@@ -2022,6 +2031,8 @@ import type { SelectChangeEventDetail as IIonSelectSelectChangeEventDetail } fro
20222031
export declare interface IonSelect extends Components.IonSelect {
20232032
/**
20242033
* Emitted when the value has changed.
2034+
2035+
This event will not emit when programmatically setting the `value` property.
20252036
*/
20262037
ionChange: EventEmitter<CustomEvent<IIonSelectSelectChangeEventDetail>>;
20272038
/**
@@ -2232,6 +2243,8 @@ export declare interface IonTextarea extends Components.IonTextarea {
22322243
* The `ionChange` event is fired when the user modifies the textarea's value.
22332244
Unlike the `ionInput` event, the `ionChange` event is fired when
22342245
the element loses focus after its value has been modified.
2246+
2247+
This event will not emit when programmatically setting the `value` property.
22352248
*/
22362249
ionChange: EventEmitter<CustomEvent<IIonTextareaTextareaChangeEventDetail>>;
22372250
/**
@@ -2384,8 +2397,9 @@ import type { ToggleChangeEventDetail as IIonToggleToggleChangeEventDetail } fro
23842397

23852398
export declare interface IonToggle extends Components.IonToggle {
23862399
/**
2387-
* Emitted when the user switches the toggle on or off. Does not emit
2388-
when programmatically changing the value of the `checked` property.
2400+
* Emitted when the user switches the toggle on or off.
2401+
2402+
This event will not emit when programmatically setting the `checked` property.
23892403
*/
23902404
ionChange: EventEmitter<CustomEvent<IIonToggleToggleChangeEventDetail>>;
23912405
/**

packages/angular/standalone/src/directives/proxies.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,9 @@ import type { AccordionGroupChangeEventDetail as IIonAccordionGroupAccordionGrou
126126

127127
export declare interface IonAccordionGroup extends Components.IonAccordionGroup {
128128
/**
129-
* Emitted when the value property has changed
130-
as a result of a user action such as a click.
131-
This event will not emit when programmatically setting
132-
the value property.
129+
* Emitted when the value property has changed as a result of a user action such as a click.
130+
131+
This event will not emit when programmatically setting the `value` property.
133132
*/
134133
ionChange: EventEmitter<CustomEvent<IIonAccordionGroupAccordionGroupChangeEventDetail>>;
135134
}
@@ -1486,6 +1485,8 @@ import type { PickerColumnChangeEventDetail as IIonPickerColumnPickerColumnChang
14861485
export declare interface IonPickerColumn extends Components.IonPickerColumn {
14871486
/**
14881487
* Emitted when the value has changed.
1488+
1489+
This event will not emit when programmatically setting the `value` property.
14891490
*/
14901491
ionChange: EventEmitter<CustomEvent<IIonPickerColumnPickerColumnChangeEventDetail>>;
14911492
}

0 commit comments

Comments
 (0)