Add support for horizontal scrolling in 'scrollIntoView' in ui_utils.js

This patch improves `scrollIntoView`, by adding support for horizontal scrolling as well.
To (hopefully) prevent this from causing issues, horizontal scrolling is *only* applied when the `spot.left` property is supplied.

Fixes #3953.