Bug 228843 - Implement auto-expanding details
Summary: Implement auto-expanding details
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: sideshowbarker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-08-05 13:28 PDT by Joey Arhar
Modified: 2024-05-22 09:43 PDT (History)
18 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joey Arhar 2021-08-05 13:28:52 PDT
In this HTML spec PR, we are making <details> automatically expand for element fragments and find-in-page: https://github.com/whatwg/html/pull/6466
This way, the user can effectively use find-in-page to search for content hidden inside <details> elements without having to manually expand all of them first.
In order to make it performant, the spec PR also suggests using content-visibility:hidden inside <details>'s user agent shadowdom instead of "removing the slot from the rendering" when <details> are closed.
Comment 1 Radar WebKit Bug Importer 2021-08-12 10:41:39 PDT
<rdar://problem/81856620>
Comment 2 sideshowbarker 2023-10-06 14:32:50 PDT
Pull request: https://github.com/WebKit/WebKit/pull/18785
Comment 3 James Craig 2023-11-15 15:27:09 PST
Whoever works on this feature, please work with WebKit Accessibility DRIs to make sure it works with accessibility, such as VoiceOver navigation by heading (VO+Cmd+H), where heading is in a collapsed section. Or VoiceOver Find (VO+F)
Comment 4 sideshowbarker 2023-11-16 10:01:29 PST
(In reply to James Craig from comment #3)
> Whoever works on this feature, please work with WebKit Accessibility DRIs to
> make sure it works with accessibility, such as VoiceOver navigation by
> heading (VO+Cmd+H), where heading is in a collapsed section. Or VoiceOver
> Find (VO+F)

I have a PR ready for review at https://github.com/WebKit/WebKit/pull/18785. It doesn’t yet include any accessibility tests, and I’ve not yet done any manual testing of it myself with VoiceOver, but I’d love to get some guidance and review.
Comment 5 Tyler Wilcock 2023-12-20 15:33:56 PST
(In reply to sideshowbarker from comment #4)
> (In reply to James Craig from comment #3)
> > Whoever works on this feature, please work with WebKit Accessibility DRIs to
> > make sure it works with accessibility, such as VoiceOver navigation by
> > heading (VO+Cmd+H), where heading is in a collapsed section. Or VoiceOver
> > Find (VO+F)
> 
> I have a PR ready for review at https://github.com/WebKit/WebKit/pull/18785.
> It doesn’t yet include any accessibility tests, and I’ve not yet done any
> manual testing of it myself with VoiceOver, but I’d love to get some
> guidance and review.
VO-Cmd-H (find next heading) works via Accessibility::findMatchingObjects, which traverses the AX tree to try and find objects that match the given search key. AccessibilitySearchKey::Heading is one of many such keys. VO-F works similarly, searching the AX tree for the target AccessibilitySearchCriteria::searchText and comparing it against several different types of accessibility text.

Unfortunately, I don't think either will "just work" as the contents of collapsed details elements are not part of the AX tree (because they are not rendered, inherently excluding them). So we’ll need to do something special here.

Maybe we need to compute “collapsed descendants” for closed details element AX objects, which includes AX objects ignored only due to their lack of visibility / rendering. This collapsed descendants function would return early if the object’s role is not details, or if it is expanded.

Then we update `findMatchingObjects` to check an object’s collapsed descendants for matches. If a collapsed descendant is found to be a match, we’ll need to call `AXCoreObject::setIsExpanded(true)` on the containing details.

But this is pretty complicated, maybe there is some simpler solution here...not sure.