World Map toggle doesnt turn map off

When mouse-cursor is pointed at the World-Map-pane the toggle to turn the map off doesnt work if it is bound to mouse-button-5. The keyboard key M does work for this, but Id rather have mouse-button-5 working as keybind for the toggle.

Any help pls ?