By adding "base:right;" to the addInstance() call, the first level sub-menus will take the right border of the frame as a reference base for alignment, thus change of the frame width won't affect the position of sub-menus.
< | ==| | adjust the frame width to test the sub-menus. |