Fix JS errors occurring during EnterKeyHandling in IE11. Curiously, the ...

...tests did not catch them. Fixes #17466.