Skip to content

Commit 6395eb0

Browse files
authored
docs: note event bubbling (#3522)
1 parent b53d59a commit 6395eb0

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

docs/api/accordion.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ import Toggle from '@site/static/usage/v8/accordion/toggle/index.md';
3636

3737
## Listen for Accordion State Changes
3838

39+
:::caution
40+
Most `ionChange` events emitted by other components such as [Input](./input) and [Textarea](./textarea) bubble. As a result, these events will bubble up and cause your `ionChange` listener on the Accordion Group to fire if the associated components are used inside of an Accordion.
41+
42+
When using other components that emit `ionChange` inside of Accordion it is recommended to have the `ionChange` callback on Accordion Group check the `target` key on the event passed to the callback to verify that `ionChange` is coming from the Accordion Group and not any descendants.
43+
:::
44+
3945
Developers can listen for the `ionChange` event to be notified when accordions expand or collapse.
4046

4147
import ListenChanges from '@site/static/usage/v8/accordion/listen-changes/index.md';

plugins/docusaurus-plugin-ionic-component-api/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,9 @@ function renderEvents({ events }) {
168168
}
169169

170170
return `
171-
| Name | Description |
172-
| --- | --- |
173-
${events.map((event) => `| \`${event.event}\` | ${formatMultiline(event.docs)} |`).join('\n')}
174-
175-
`;
171+
| Name | Description | Bubbles |
172+
| --- | --- | --- |
173+
${events.map((event) => `| \`${event.event}\` | ${formatMultiline(event.docs)} | \`${event.bubbles}\` |`).join('\n')}`;
176174
}
177175

178176
function renderMethods({ methods }) {

versioned_docs/version-v7/api/accordion.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ import Toggle from '@site/static/usage/v7/accordion/toggle/index.md';
3939

4040
## Listen for Accordion State Changes
4141

42+
:::caution
43+
Most `ionChange` events emitted by other components such as [Input](./input) and [Textarea](./textarea) bubble. As a result, these events will bubble up and cause your `ionChange` listener on the Accordion Group to fire if the associated components are used inside of an Accordion.
44+
45+
When using other components that emit `ionChange` inside of Accordion it is recommended to have the `ionChange` callback on Accordion Group check the `target` key on the event passed to the callback to verify that `ionChange` is coming from the Accordion Group and not any descendants.
46+
:::
47+
4248
Developers can listen for the `ionChange` event to be notified when accordions expand or collapse.
4349

4450
import ListenChanges from '@site/static/usage/v7/accordion/listen-changes/index.md';

0 commit comments

Comments
 (0)