It seems that querying the screen position is just a heuristic they came up with to determine the nature of the event. Instinctively I would use instance of MouseEvent for this, but even this feels risky/hacky to me.
My question is why they're relying on those heuristics. My guess is that toggleMenu is being used by multiple event handlers. Or maybe there's something else going on that is specific to their codebase.
It's hard to judge without knowing the full picture.
EDIT: Aha, there's an answer here: https://news.ycombinator.com/item?id=42174177