Open colbyfayock opened 3 months ago
yeah that looks great!!
the only other place i was kinda thinking about it was the individual media view. two ideas there, 1 if youre just viewing and hit ESC, it goes back to the main view, almost like it's a modal (but is this unexpected? feels intuitive to me) and in the same media view, if you hit Edit or really any of the menus, if you hit ESC, it would close it
the only consideration to be careful with in the last part is do we need some kind of confirmation that they'll lose changes?
wdyt? also dont feel to wrap this all in the scope of this one issue :D
I can create a separate issue for the individual media view as it is out of scope for this particular issue.
Pressing escape makes sense to me to go back to the main view, and I definitely agree about a confirmation before returning to the main gallery view if there are unsaved changes.
Can you assign this to me, @colbyfayock? Thanks! PR incoming.
Is this just for the Media Gallery component? I've got the project running locally, and adding the following does the job.
If the functionality is required elsewhere, we could wrap the logic into a custom hook that receives the
keydownHandler
. You could also leverage a custom hook, like https://usehooks.com/usekeypress, but I'd opt for on keydown.