themefoundation/mo-js — pull request #2 by stephenharris (2013-10-18 12:26:33+00:00)
Title: On hover, prevent rightmost submenus from leaving the viewport

I was playing around having the menu aligned to the right in a theme I was working on. I noticed that a "wide" sub-menus would leave the viewport. ("wide" here means wider than its parent + parent's distance from right edge of the screen).

I don't have a public demo of this bug yet, but attached is the fix (which works for me). Basically if the position of the right-edge of the submenu is off-screen, it adjust the `left` attribute (normally 0) to correct it.

This only fixes this for menus with two-layers. A third layer may still disappear off the viewport. As far as I can tell this patch doesn't break anything new.