Close any Metronic Drawer after Escape key pressed
Hi keenthemes,
I'm struglling with this issue.
I would like to whatever the drawer that is on focus, if I press Escape key, the drawer will hide/close automatically,
NB : Even if there's many drawers open,(eg: 1 from left, when you click on a link inside this drawer a 2 drawer will open from the left, and you click on a link on this drawer, a 3 rd drawer will open in right. when you press Escape key it would close/hide this 3 rd drawer, if you then press Escape again it would close hide the 2nd drawer, if you click on the Escape again, it will hide/close the 1 st Drawer)
Hope you got the point.
I manage to do it with modals by using autofocus in modal div, but I am fighting to make it work with drawers.
This option is already implemened in Bootstrap 5.2 offcanvas (Think that's where KT Drawer came fr) https://getbootstrap.com/docs/5.0/components/offcanvas/
just by pressing Escape key the offcanvas close/hide