Fix a bug when menu are larger than the screen edge