Skip to content

Auto-expanding details elements #578

Closed

Description

@josepharhar

Request for Mozilla Position on an Emerging Web Specification

Other information

This feature will support ScrollToTextFragment in chromium, but it is perfectly useful to have it only implemented for find-in-page and element fragment navigation. The HTML spec for this feature omits ScrollToTextFragment.

Activity

  1. added
    venue: WHATWG
    on Sep 21, 2021
  2. BillGoldstein commented on Sep 22, 2021

    @BillGoldstein

    FWIW, I'd like to advocate for this...for a11y reasons.
    I see this as solution for an issue with navigation to any fragment id within a closed details element, e.g. landmark navigation.
    Involves changing closed details elements to use content visibility hidden, rather than current handling.

  3. jcsteh commented on Sep 23, 2021

    @jcsteh
    Contributor

    I think this could be really problematic for screen reader users. On one hand, yes, it means that the entire content of a details element will be navigable with quick navigation, including headings, landmarks, etc. On the other hand, it means that as a user moves the screen reader browse cursor, they will always see the content of collapsed details elements, which somewhat defeats the point of them being collapsed. That could perhaps be accommodated on the screen reader side, but that would require changes in all screen readers and we'd need to think about backwards compat. I suspect the same is true for switch control.

  4. jcsteh commented on Sep 23, 2021

    @jcsteh
    Contributor

    I think this could be really problematic for screen reader users. On one hand, yes, it means that the entire content of a details element will be navigable with quick navigation, including headings, landmarks, etc. On the other hand, it means that as a user moves the screen reader browse cursor, they will always see the content of collapsed details elements, which somewhat defeats the point of them being collapsed.

    Sorry; I think I misunderstood something here. I was assuming that if collapsed details elements were exposed to find-in-page, they would also be exposed to the a11y tree. If they aren't, please disregard my concern. Note, however, that this also means that landmark navigation, heading navigation, etc. (other than by the use of direct HTML links or other navigation to those things) wouldn't work inside collapsed details elements.

  5. josepharhar commented on Sep 23, 2021

    @josepharhar
    Author

    I was assuming that if collapsed details elements were exposed to find-in-page, they would also be exposed to the a11y tree. If they aren't, please disregard my concern.

    Since collapsed details will use content-visibility:hidden, they will not be exposed to the accessibility tree.

    this also means that landmark navigation, heading navigation, etc. (other than by the use of direct HTML links or other navigation to those things) wouldn't work inside collapsed details elements

    Could you elaborate on landmark navigation and heading navigation? I'm not sure what you mean.

  6. annevk commented on Sep 23, 2021

    @annevk
    Contributor

    They are functionality provided by AT, e.g., to skip directly to the third heading (some <hx> element) in a document.

  7. vmpstr commented on Sep 23, 2021

    @vmpstr

    Note, however, that this also means that landmark navigation, heading navigation, etc. (other than by the use of direct HTML links or other navigation to those things) wouldn't work inside collapsed details elements.

    That's correct. Currently the contents of a collapsed detail element are not exposed to AT, and this feature does not change this behaviour.

    The feature enables some things, namely find-in-page scroll-to-text and fragment-link navigation, to open a details element automatically if the target of the search/navigation is within a collapsed details element.

    This does not propose to change things like tab navigation, focus navigation, or landmark or heading navigation. All of these still will not be able to open a collapsed details element automatically.

    The difficulty in providing this information to AT, in order for it to be able to do landmark navigation into a collapsed details element, is already mentioned above, namely the following:

    it means that as a user moves the screen reader browse cursor, they will always see the content of collapsed details elements, which somewhat defeats the point of them being collapsed.

    We agree that exposing all of the content in collapsed details elements seems to contradict the intent of the element. Please correct me if I'm wrong, but I don't believe there is currently a way to provide such content (hidden but potentially searchable) via AX.

  8. josepharhar commented on Sep 23, 2021

    @josepharhar
    Author

    Here is a list of different ways I'm aware of that the browser scrolls into view or navigates to some text or element:

    • find-in-page
      • Supported by this feature
    • window.find()
      • Not supported by this feature
      • Not specced, so I didn't support this in chromium. If we spec it, then I could write WPTs for find-in-page-like behavior for this feature.
    • ScrollToTextFragment
      • Supported by this feature
    • Element fragment navigation
      • Supported by this feature
    • element.scrollIntoView()
      • Not supported by this feature
      • I suppose that if the script calling scrollIntoView() wants to auto-expand details elements, it could just run the ancestor details revealing algorithm from within script before calling scrollIntoView().
      • I'm not sure how people would feel about making scrollIntoView() always expand details elements... it's distinct from find-in-page, ScrollToTextFragment, and element fragment navigation because scrollIntoView() is called by script in the page, rather than a searching and scrolling feature thats in the browser and hidden away from script.

    I also took some time to look into landmark navigation, which lead me to this browser extension which finds landmarks and provides a way to "navigate" to them: https://github.com/matatk/landmarks
    It looks like this extension uses element.scrollIntoView() and element.focus() to scroll the target landmark into view.
    Within the context of this extension, it could add the ancestor details revealing algorithm like I mentioned above. I'm not aware of any other accessibility-specific code in the browser/spec that would search for text and scroll things into view like find-in-page that would be a candidate for this feature - if there are any I'm happy to look into it though!

    We agree that exposing all of the content in collapsed details elements seems to contradict the intent of the element. Please correct me if I'm wrong, but I don't believe there is currently a way to provide such content (hidden but potentially searchable) via AX.

    I strongly agree with this view

  9. emilio commented on Sep 29, 2021

    @emilio
    Collaborator

    Yeah, I think this should be "worth prototyping" specially if there are no a11y concerns.

  10. annevk commented on Sep 29, 2021

    @annevk
    Contributor

    Thanks all, closing this as there's no need for a dashboard entry. Please do comment if there's anything that was missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    position: positivevenue: WHATWG

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions