Protect against cases where document.elementFromPoint() returns null.