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

content: add documentation for programmatically focusing in ion-app #3815

Open
brandyscarney opened this issue Sep 5, 2024 · 0 comments
Open
Labels
content Issues related to the contents of the documentation website

Comments

@brandyscarney
Copy link
Member

brandyscarney commented Sep 5, 2024

URL

https://ionicframework.com/docs/api/app

Issue Description

The ion-app component has an internal setFocus method that can be used to programmatically focus elements. We should document this usage in the ion-app documentation and remove the @internal flag:

/**
 * @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
 * 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.)
 */
@Method()
async setFocus(elements: HTMLElement[]) {
  if (this.focusVisible) {
    this.focusVisible.setFocus(elements);
  }
}

We may want to link to this documentation from other components to show how to programmatically focus them.

Related issue: ionic-team/ionic-framework#29830

@brandyscarney brandyscarney added triage New issues content Issues related to the contents of the documentation website labels Sep 5, 2024
@ionitron-bot ionitron-bot bot removed the triage New issues label Sep 5, 2024
@ionic-team ionic-team deleted a comment Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Issues related to the contents of the documentation website
Projects
None yet
Development

No branches or pull requests

1 participant