The described method to ‘unselect’ a menu item works for the global items (e.g., unselect() but not when a specific menu item is named (e.g., menu.unselect(“align-left”);). Here is a snippet.
Hello Neil.
In the provided snippet unselect() methods works well and it unselects the “align-left” item on a calling.
When I open this snippet and click on ‘SELECT’ the menu item ‘Format’ is selected and is highlighted. When I click on ‘UNSELECT’ (to launch menu.unselect(“align-left”);), the menu item IS NOT unselected. However, if I use menu.unselect();, it works. If it is working for you, what is different? I am using Chrome (most recent v). Thank you.
I’m using the latest Google chrome ( v117.0.5938.132 for now).
Here is a demonstration:
https://recordit.co/1KPrze2LTL
Yes, but you are using unselect() and that works for me as well. It is when I use the specific reference to the id that it fails. For example, menu.unselect(“align-left”) does NOT work. Can you try that? Thank you.
In your provided snippet there is no unselect(), only a unselect(“align-left”).
Also, in case of using unselect() ALL the selected items would be cleared, while in the video you can see that all the parent elements stayed selected, while the “aling-left” item deselected.