Make the ApplyStyleHandler a singleton so it can be readily used in other parts of the app. Not necessarily an ideal solution, but it'll do for now.
Apply style menu now shows current style state wrt the selection.
Still not functioning correctly as selecting a style removes the menu.
Change 'cancel' to 'close' which better reflects how a multi select popup works.
Change the state indicator (the menu item ticks) to be invisible rather than hidden to avoid the menu changing in width when state is selected/deselected.
Change the way in which the multi select popup works so that selecting an item no longer hides the menu. Note that it does still callback so that the client can update the state of the DOM if needed. The advantage for things like the apply styles menu is that the DOM is changed as the user check/unchecks items rather than having to wait until the menu is closed to see the effect on the DOM. Slight downside is that it makes the client code a bit more complicated as they have to check to see if the menu was close or not before acting.
Tidy.
Make sure that the focus is restored after tapping on a tab panel's tab. This doesn't change behaviour on desktop but does improve it on iOS where the selection was lost if you tapped across the toolbar tabs. Now it isn't.
Not sure why I did it this way in the first place so perhaps I'm missing something...?
Remove commented out code left in previously just in case...
Changes intended to make the popup menu suitable for both multi and single select uses.