Ensure scrollbar/width instability doesn't cause infinite loop

Issue #1787