AccessibilityRenderObject::nextSibling currently has this logic to return nullptr if the computed sibling has a parent different from `this`: // Make sure next sibling has the same parent. auto* nextObject = objectCache->getOrCreate(nextSibling); if (nextObject && nextObject->parentObject() != this->parentObject()) return nullptr; This is problematic in the presence of display: contents since we expect parent object differences due to the way this property affects the render tree. Concretely, this breaks the firstChild(), nextSibling() iteration we do throughout WebKit, as when we get to an element with display: contents we get a parent mismatch and iteration stops unnecessarily.
<rdar://problem/90611872>
Created attachment 455328 [details] Patch
(In reply to Tyler Wilcock from comment #2) > Created attachment 455328 [details] > Patch We need to maintain a consistent parent-child hierarchy in the AX tree. That includes that an object and its siblings have the same parent. display: contents should affect the way AX Objects are added to the AX tree, but not mess up the parent-child relationship. Instead, we may need to add a new kind of AX object for display: contents that encapsulates the appropriate parent-child relationships for these objects.
Committed r291747 (248779@main): <https://commits.webkit.org/248779@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 455328 [details].