if x === null || y === null, you may just return from the function -- I don't think there is a need to scroll into view.