These two examples import the same MapTypeMenuControl.js where the control's code lives. The only difference between working and broken menus is in the way the object is created. Instead of inserting the menu in the map object where it belongs, I append it the document body here to avoid having clicks stolen anything listening to the map div.