![]() I do have one other thing you can do straight away (I know sometimes there is not the scope to fix things right now) as a stop-gap "solution".Īdd tabindex="1" to the search box so it is the first item that receives focus and make sure you have "skip to content" links so people can bypass the menu. If you have the knowledge of how to implement WAI-ARIA correctly then that is the best option, if not then making the Esc key close the mega menu and or pressing "up" when at the top of the list to get back to the top level links is a reasonable compromise. The final consideration is that once a menu is open that is a "mega menu" style (multiple columns), you should ideally implement arrow key navigation to take you between columns and items.Īs for whether pressing Tab should go to the next top level item it is something that I am not sure if there is any guidance on, I personally say yes it should and arrow keys are for navigation within a drop-down, but I would make it a true drop-down with aria-owns on the and aria-expanded for whether it is open or closed. If the top level item is a link to another page then follow the principles of option 2 and have an additional drop-down icon next to the main link instead (with aria-label="open (menuItemName)" for example). Then opening the menu is as simple as toggling the CSS class and avoids any potential errors with managing tabindex. ![]() Much better than tabindex="-1" would just be to add display: none via a CSS class and change the menu item to a (assuming the top level menu item is not a link). If you need some reassurance check the W3 examples for a flyout menu Your solution is the correct solution and does indeed improve the accessibility for keyboard users. So, until the user clicks out of the focus of that menu, the program won't be coming out to execute the next lines of the function (in which you are calling the tk_popup for the submenu.) The reason is that using tk_popup or post will make the menu appear on the screen for sure, but then the program's focus gets shifted to the user's mouse and keyboard. ![]() Even if you add some gap to the x-y values using some integers, still you won't be seeing the second menu. (my_menu, my_menu2), but my attempt just displays both but with theįirst menu overlapping, so the other doesn't show. When I middle-click, I tried to make it so it displays both the menus You will have to create a customized menu bar without using the widget tk.Menu. "That's just not how Tkinter menus are designed to work." The first menu AND then automatically runs the cascade, as if it wasĬonsidering this answer by Bryan Oakley and the documentation available on the internet, there is no way for making a menu and a submenu visible simultaneously. So the question is, how do I make it so when middle-clicking, it opens
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |