FoundryVTT-Level-Up-Official
FoundryVTT-Level-Up-Official copied to clipboard
[Enhancement] Auto focus on the roll button in roll dialogs
Focus the button element in roll dialogs so that users can just hit enter when a roll dialog is triggered instead of having to navigate to it via the mouse or keyboard.
This isn't the right move for this functionality. Focusing the button at the bottom of the dialog comes with several problems:
-
If the dialog needs to scroll, we're going to be hiding the information at the top of the dialog, which is often the most important bit.
-
If people want to tab to other parts of the dialog, we've already effectively tabbed them to the end, and the next tab may actually take them outside of the dialog.
What we should be doing instead is relying on the normal behaviour of HTML forms. If an HTML form is in focus, pressing enter will trigger a submission of the form if there is an input or button of type submit in the form. We have submit buttons for our roll dialogs, so we should be able to put the form in focus, rather than needing to focus the submission button itself.