Introduce reusable isClickOnToggleElement event property instead of special-casing inside event handlers

With the toggle-element feature introduced recently, a few event handlers are given different behaviour if the click happens to be on a toggle element.

For reusability and clarity, it's much better to let that logic be handled by the EventMatcher, which is built for that task.

This pull request rewrites the new behaviour by using the EventMatcher.