Correct positioning and sizing logic for context menu (#14863).

Change-Id: Ic2edd6e6f53cd8ae3dc2d39477f59261356beafd