Revise patch 50621941b536805b2c62cb0fb5e1bc8a98e8877d

The previous solution broke test doc_docKeepsScroll.