-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Feature Request
Ionic version:
[x] 5.1.1
Describe the Feature Request
Currently only the IonInput, IonTextarea, and IonSearchbar components offer a setFocus interface for programmatically focusing the component. It was suggested in the Slack group that this was due to those components needing to bring up the mobile keyboard and there being no value to focusing other types of elements programmatically. However, on desktop/web there is value to managing focus, particularly for supporting custom keyboard accessibility features. In our case, we are trying to implement a searchable select component, and would like to be able to tab through the options using arrow keys. Without programmatic access to the select options (we are using IonRadio components), we cannot manage the focus.
Describe Preferred Solution
The IonRadio, IonCheckbox, IonItem, and IonButton components should have a setFocus interface available on their refs. Calling setFocus on the ref would apply focus to the native element wrapped by that component.
Describe Alternatives
Currently the only workaround we've come up with is to use native HTML elements in place of Ionic components, but doing so requires also implementing custom styles for the native elements.
Related Code
I think this is understandable without a code example, but let me know if any supporting code would be helpful to see.
Additional Context