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
Alert should auto focus first input #16941
Comments
That should be a setting. Otherwise there will always be a software keyboard popup on mobile platforms. |
Not that easy, since element.focus() is noop if it's not coming from an user interaction. |
There might be challenges if running on a mobile device (due to keyboard popup) but it seems like you would always want to set focus on a desktop web page. Most web apps (including GitHub) set input focus when you click on buttons that lead to data entry. It seems very awkward to click on a button, have an alert displayed to enter a value, and still have to click in the input before entering the value. |
Hoping this feature is coming to Ionic 6 ! I am in need of this as well |
Any updates on this? Doesn't seem this feature made it into v6. |
you can resolve it like this: const alert = await this.alertCtrl.create(
{
header: "Motivo!",
message: 'Descreva um motivo para <strong>rejeição</strong>!',
inputs: [
{
name: 'comentario',
id: 'comentario',
type: 'textarea',
placeholder: 'Descreva um motivo'
}
],
buttons: [
{
text: 'Cancelar',
id: 'confirm-button',
handler: async (data: object) => {
resolve(false)
}
},
{
text: 'OK',
id: 'confirm-button',
handler: async (data: object) => {
resolve(data)
}
},
]
})
await alert.present()
const comentario :HTMLElement = document.querySelector("#comentario");
comentario.focus(); |
Prompts don’t auto focus first input
The text was updated successfully, but these errors were encountered: