You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a simple AlertDialog in my app (to confirm that the user really wants to delete something, though this shouldn't really matter). The dialog has both an "Action" and a "Cancel" elements. I have an "onClick" handler attached to my action element that triggers deletion, but I'd also like that handler to be called when the dialog is accepted using the "enter" key (currently, pressing "enter" closes the dialog only).
Is there a more generic "dialog accepted" callback I can use, instead of the action element's onClick callback? Or do I need to manually listen to the keyboard event?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm using a simple AlertDialog in my app (to confirm that the user really wants to delete something, though this shouldn't really matter). The dialog has both an "Action" and a "Cancel" elements. I have an "onClick" handler attached to my action element that triggers deletion, but I'd also like that handler to be called when the dialog is accepted using the "enter" key (currently, pressing "enter" closes the dialog only).
Is there a more generic "dialog accepted" callback I can use, instead of the action element's onClick callback? Or do I need to manually listen to the keyboard event?
Beta Was this translation helpful? Give feedback.
All reactions