DJ Megamenu - WCAG 2.1 keyboard navigation

DJ Megamenu - WCAG 2.1 keyboard navigation

According to the WCAG 2.1 guidelines, no keyboard trap may exist for navigation. Therefore it must be possible to close a submenu using e.g. the Escape key. Would anyone be able to guide me on implementing this?

I found the code where the tab and left-right-up-down keys are implemented and would like to add the escape key