IE11 and Chrome move focus to the body if the CSS display property of the the currently focused element is set to 'none'.
This behavior is correct since elements that have focus should not lose their visibility while they have focus. This would conflict with the Best Practice Ensure keyboard focus is indicated visually.
Steps to Reproduce
- Open this page in Chrome
- Open the console in Chrome Devtools
- TAB to the Show/Hide button above
- Activate the Show/Hide button using the ENTER key
- Watch the console for output and read the alert dialogs that contain messaging regarding the currently focused element