Adding keyboard shortcuts to common actions#30950
Conversation
|
This is cool! |
Yes! Like YouTube, we can have a modal (at each tab level) that popups upon clicking a button that will show all the shortcuts relevant to that tab. On YouTube, we can see that by hitting |
|
|
||
| const initialClearButtonFocusRef = useRef<HTMLButtonElement>(null); | ||
|
|
||
| useKeysPress("shiftKey", ['c', 'C'], onOpen); |
There was a problem hiding this comment.
Cool! Do you have a list of what shortcuts you want to do? We'll need to check this across browsers or toggle on/off if it conflicts with a user's shortcuts for something else.
There was a problem hiding this comment.
Hi @bbovenzi,
Added below shortcuts to the DAGS grid screen -
- At DagRun
- Clear existing tasks (
shift + c) - Mark as success or fail (
shift + sorshift + f) - Add note (
shift + n)
- Clear existing tasks (
- At TaskInstance
- Clear task (
shift + c) - Mark as success or fail
(shift + sorshift + f) - Add note (
shift + n)
- Clear task (
The shortcuts are the same, just depends on what is selected. Will add more in the process.
Yes, I have checked with major browsers (Chrome, Firefox, Edge, Opera), and these shortcuts aren't used as of yet (At least nothing happened when I clicked :)).
There was a problem hiding this comment.
Hi @bbovenzi,
I have fixed all the issues. Can you have a look once at the implementation?
There was a problem hiding this comment.
Looking good!
Do we want to add a cheatsheet somewhere?
Also, for adding a note, we should make sure to toggle the accordion open if it is closed.
There was a problem hiding this comment.
Thanks for having a look.
Yes, working on creating the cheat sheet.
Yes, will make sure to toggle the notes accordion open (if closed).
There was a problem hiding this comment.
Looking good! Do we want to add a cheatsheet somewhere? Also, for adding a note, we should make sure to toggle the accordion open if it is closed.
Hi @bbovenzi
- Added a cheat sheet for shortcuts
- Yes, toggling the accordion and making the text area in focus
…list - At DagRun - Clear existing tasks (shift + c) - Mark as success or fail (shift + s or shift + f) - Add note (shift + n) - At TaskInstance - Clear task (shift + c) - Mark as success or fail (shift + s or shift + f) - Add note (shift + n)
…cut cheat sheet - added cheat sheet modal - using local storage variable to ignore event which text area is in focus
Hi @eladkal, |
|
Hi @bbovenzi ,
Do let me know if I missed anything. |
…list - At DagRun - Clear existing tasks (shift + c) - Mark as success or fail (shift + s or shift + f) - Add note (shift + n) - At TaskInstance - Clear task (shift + c) - Mark as success or fail (shift + s or shift + f) - Add note (shift + n)
…cut cheat sheet - added cheat sheet modal - using local storage variable to ignore event which text area is in focus
@bbovenzi any thoughts on the above? |
| cache: EmotionCache; | ||
| } | ||
|
|
||
| const isInputInFocus: IsInputInFocus = "isInputInFocus"; |
There was a problem hiding this comment.
it's just a string we don't need a special type for it.
| const isInputInFocus: IsInputInFocus = "isInputInFocus"; | |
| const isInputInFocus = "isInputInFocus"; |
There was a problem hiding this comment.
Here the idea behind having a type for a string was to enforce this to have only specific values (since it is the key of the local storage object). In the above case, it was below.
// In type/index.ts
type IsInputInFocus = "isInputInFocus";
We can replace it with a global constant that will be imported wherever used. Where can I define a constant to import it anywhere required? I do not seem to find where we define all constants used in UI.
There was a problem hiding this comment.
Just exporting the string from the useKeysPress is fine.
There was a problem hiding this comment.
Done. Defined in useKeysPress and importing it everywhere.
| }; | ||
|
|
||
| useKeysPress( | ||
| keyboardShortcutIdentifier.toggleShortcutCheatSheet.primaryKey, |
There was a problem hiding this comment.
Could we just pass keyboardShortcutIdentifier.toggleShortcutCheatSheet and onToggleShortcut?
| keyboardShortcutIdentifier.viewNotes.secondaryKey, | ||
| () => { | ||
| // toggling notes accordion (index = 0) | ||
| toggleNotesAccordionIthIndex(0); |
There was a problem hiding this comment.
I don't think we need all this extra toggleNotesAccordionIthIndex just toggle the editMode
There was a problem hiding this comment.
True! But implemented toggleNotesAccordionIthIndex, thinking new panels might be included in the accordion in the future. Since you think that it might be overkill, hence replaced it with the simplest implementation - toggleNotesPanel
| }, | ||
| }; | ||
|
|
||
| export default keyboardShortcutIdentifier; |
There was a problem hiding this comment.
Should we put a small prompt somewhere so users even know this exists?
There was a problem hiding this comment.
Text could be smaller, and we could just say : "Type shift+/ for shortcuts
- fixed static check failure
- added isInputInFocus in useKeysPress and importing it from here everywhere
|
@bbovenzi can this be merged now? |


closes: #22870
Hello,
Added below shortcuts to the DAGS grid screen -
shift + c)shift + sorshift + f)shift + n)shift + e)shift + c)(shift + sorshift + f)shift + n)shift + e)shift + /)Added the shortcut cheat sheet modal -
The tasks
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.