Skip to content
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

docs: event handling guidelines - programmatic vs user-initiated actions event story #7613

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/calcite-components/conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ There are a few ways to add event listeners within our components:

1 and 2 should be used whenever possible (which one you use will depend on convenience). 3 should only be used whenever 1 and 2 are not possible or ideal.

### Event handling guidelines

#### Programmatic vs User-initiated actions event story

Emitting associated events for user-initiated actions:
• Emit only when the user initiated the action that would emit the event.
• Before open/close events are an exception because these are asynchronous and users would not be able to reliably know when the event-related action is done when triggered programmatically.
• If a user triggers an event, any sequence of associated events would need to emit.

## Properties

Private/internal properties should be annotated accordingly to avoid exposing them in the doc and/or API. You can do this by using the `@private`/`@internal` [JSDoc](https://jsdoc.app/) tags.
Expand Down
Loading