<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - For keyboard users, activating a fragment URL should transfer focus and caret to the destination"
href="https://bugs.webkit.org/show_bug.cgi?id=116046#c33">Comment # 33</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - For keyboard users, activating a fragment URL should transfer focus and caret to the destination"
href="https://bugs.webkit.org/show_bug.cgi?id=116046">bug 116046</a>
from <span class="vcard"><a class="email" href="mailto:n_wang@apple.com" title="Nan Wang <n_wang@apple.com>"> <span class="fn">Nan Wang</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=276287&action=diff" name="attach_276287" title="patch">attachment 276287</a> <a href="attachment.cgi?id=276287&action=edit" title="patch">[details]</a></span>
patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=276287&action=review">https://bugs.webkit.org/attachment.cgi?id=276287&action=review</a>
<span class="quote">>> Source/WebCore/dom/Document.cpp:3969
>> + Node* nextNode = NodeTraversal::nextSkippingChildren(*node);
>
> Why are we calling nextSkippingChildren here given we're moving to the container node in nodeChildrenWillBeRemoved already?</span >
Because in nodeWillBeRemoved we are moving to the previousSibling if possible. I think running ElementTraversal::previous on nextSkippingChildren will cover both cases.
I just found a bug with this in such case: <div id="container"><input id="removed"><input><input></div>
After removing first input, next focused element will be the last input but we want the second one. I think we should use next instead of nextSkippingChildren.
<span class="quote">>> Source/WebCore/dom/Document.cpp:4101
>> + if (m_focusNavigationStartingNode.get() == nodeToBeRemoved) {
>
> This is a very inefficient way of checking that m_focusNavigationStartingNode is getting removed.
> Instead, just check "m_focusNavigationStartingNode && m_focusNavigationStartingNode->parentNode() == this".
> Also, this code has a bug that it doesn't check the possibility that an ancestor of m_focusNavigationStartingNode is getting removed.
> e.g. m_focusNavigationStartingNode is at the span in <div><span></span></div> and div is getting removed.
> So we need to walk up the ancestor chain of m_focusNavigationStartingNode and check whether any of it matches this.
> r- because of this bug.
> Also, please add a test case for this.</span >
Good point, will handle this case.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>