Declined
Last Updated: 06 Oct 2023 07:25 by ADMIN
Michael D
Created on: 29 Sep 2023 11:45
Category: Menu
Type: Bug Report
0
ContextMenu - menu is not closed when it looses focus via keyboard
The Kendo ContextMenu widget is automatically closed when the user clicks anywhere else on the page. This is done by subscribing to the "mousedown" event on the document. However, when you use TAB or any other way to leave the menu without triggering a "mousedown" event, it stays open forever. This behavior can be reproduced in all examples and DOJOs.
I would instead suggest closing the menu as soon as it looses focus.
1 comment
ADMIN
Georgi Denchev
Posted on: 06 Oct 2023 07:25

Hello, Michael,

The ContextMenu has built-in keyboard navigation that is enabled by default:

https://docs.telerik.com/kendo-ui/controls/menu/contextmenu/accessibility/keyboard-navigation#keyboard-navigation 

You can close the ContextMenu via the keyboard by either selecting an item(Enter key) or exiting without making a selection(Esc key).

Nevertheless, if you wish to close the menu when it loses focus then you'd have to manually implement the logic as the menu is not meant to close on lost focus by design:

  $("#context-menu").on("keydown", (e) => {
    if(e.which === 9) {
      $("#context-menu").data("kendoContextMenu").close()
    }
  });

Dojo

https://dojo.telerik.com/@gdenchev/UlAsImoF 

I hope the above information will be helpful.

Best Regards,
Georgi Denchev
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources