Document::focusNavigationStartingNode needs to take shadow tree and slotted content into account. This is a bit tricky because this code needs to traverse the composed tree forward & backward.
Antti, what do you think about adding the support for traversing backwards to ElementAndTextDescendantIterator and ComposedTreeIterator?
<rdar://problem/46178587>
Created attachment 355311 [details] A patch to add a test case
(In reply to Ryosuke Niwa from comment #1) > Antti, what do you think about adding the support for traversing backwards > to ElementAndTextDescendantIterator and ComposedTreeIterator? Good idea!