function safeBlur(el) {
  // Find the actual focused element when the active element is inside a shadow root
  while (el && el.shadowRoot && el.shadowRoot.activeElement) {
    el = el.shadowRoot.activeElement;
  }

  if (el && el.blur && el !== document.body) {
    el.blur();
  }
}
Blur the specified element, as long as it's not the HTML body element.
This works around an IE9/10 bug - blurring the body causes Windows to
blur the whole application.

@param {Element} el to blur