Skip to content

docs(app): add setFocus to the documentation #29916

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

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ ion-alert,css-prop,--width,ios
ion-alert,css-prop,--width,md

ion-app,none
ion-app,method,setFocus,setFocus(elements: HTMLElement[]) => Promise<void>

ion-avatar,shadow
ion-avatar,css-prop,--border-radius,ios
Expand Down
3 changes: 3 additions & 0 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ export namespace Components {
"trigger": string | undefined;
}
interface IonApp {
/**
* Used to set focus on an element that uses `ion-focusable`. Do not use this if focusing the element as a result of a keyboard event as the focus utility should handle this for us. This method should be used when we want to programmatically focus an element as a result of another user action. (Ex: We focus the first element inside of a popover when the user presents it, but the popover is not always presented as a result of keyboard action.)
*/
"setFocus": (elements: HTMLElement[]) => Promise<void>;
}
interface IonAvatar {
Expand Down
1 change: 0 additions & 1 deletion core/src/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class App implements ComponentInterface {
}

/**
* @internal
* Used to set focus on an element that uses `ion-focusable`.
* Do not use this if focusing the element as a result of a keyboard
* event as the focus utility should handle this for us. This method
Expand Down
1 change: 1 addition & 0 deletions packages/angular/src/directives/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Shorthand for ionAlertDidDismiss.


@ProxyCmp({
methods: ['setFocus']
})
@Component({
selector: 'ion-app',
Expand Down
3 changes: 2 additions & 1 deletion packages/angular/standalone/src/directives/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ Shorthand for ionAlertDidDismiss.


@ProxyCmp({
defineCustomElementFn: defineIonApp
defineCustomElementFn: defineIonApp,
methods: ['setFocus']
})
@Component({
selector: 'ion-app',
Expand Down
Loading