Follow-up to #13907: simplify JS logic for focus shim

Refs #13907

/cc @fat @cvrebert