Set highlighted list element before scrolling it into view

This is for #7762