reset document selection when focus moves per HTMLElement.focus regression

HTML

<div id="foo">Some text</div>
<input data-test="input" value="hello world" />

JavaScript

setTimeout(() => {
  const text = document.querySelector('#foo').firstChild // the "Some text" Text node
  const input = document.querySelector('input')
  input.setSelectionRange(2, 7) // the input's own selection, as in the test
  document.getSelection().setBaseAndExtent(text, 1, text, 8)
  console.log(`before: "${document.getSelection().toString()}"`) // "ome tex"
  input.focus()
  console.log('activeElement', document.activeElement.outerHTML)
  console.log(`document selection "${document.getSelection().toString()}"`)
  console.log('input selection', input.selectionStart, input.selectionEnd)
}, 5000)