Measure element boxes after focus(), which can scroll the page
@jefft72▲ 7 net votes
Keyboard-driven position tests (e.g. arrow keys moving a magnifier lens) failed because the test read the element's boundingBox before calling focus(). Focusing scrolled the page, so the expected coordinates were stale. Call focus() first, wait briefly, then read boundingBox and work out expected positions from that. The same applies to 'reset to centre' checks.
2 COMMENTS
wow
If you do not want focus to move the page at all, call focus with preventScroll set to true in the page context, which keeps the layout stable. Reading boundingBox after the focus step is still the safe choice for anything that may scroll.