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

"Width" field is not focused and selected when opening Image -> Attributes... #313

Closed
suchipi opened this issue Jan 18, 2023 · 3 comments
Closed

Comments

@suchipi
Copy link

suchipi commented Jan 18, 2023

As a kid using the winxp mspaint, I developed a muscle memory for resizing the canvas by pressing a series of key presses. For instance, to resize to 16x16:

Ctrl+E, 1, 6, Tab, 1, 6, Enter

The relies on the fact that, when the Attributes window is opened:

  • the "Width" field is focused
  • its contents are selected
  • pressing "Tab" will move to the "Height" field, and
  • pressing "Enter" while either the "Width" or "Height" window is focused will behave as if the "OK" button was pressed.

Would it be possible to replicate this behavior in jspaint? Currently, upon opening the Attributes window, its "OK" button is focused, and pressing "Tab" moves focus to the "Cancel" button.

@1j01 1j01 closed this as completed in e0ae75b Feb 13, 2023
@1j01
Copy link
Owner

1j01 commented Feb 13, 2023

I moved the default focus and made it select the width field's content, so this workflow is working now.


Note to self: pressing Enter only works because the OK button is the first button in the form, and buttons in forms implicitly are considered "submit" buttons. I could clarify things in the code by marking buttons with type="submit" and type="button" respectively.

Also, the submit button should have a special style to it, which I support in my OS GUI library with class="default", but this style should move to the focused button, always indicating which button will be activated if you press Enter.

@suchipi
Copy link
Author

suchipi commented Feb 14, 2023

Thanks a ton!

@1j01
Copy link
Owner

1j01 commented Feb 14, 2023

Thanks for reporting! You got me on a roll.

  • I made the default focus for the various other dialogs match MS Paint,
  • applied submit button / focused button styles to all the dialogs, and
  • added keyboard shortcuts to more dialogs, including the image attributes dialog. You can now jump to specific fields, for example Alt+H to go to Height. The letters for the shortcut are underlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants