Skip to content

[details] Move summary button to light DOM and provide summary property #5077

Closed

Description

@web-padawan

Describe your motivation

Currently, vaadin-details is the only remaining Vaadin component that has focusable element in Shadow DOM:

<div
role="button"
part="summary"
on-click="_onToggleClick"
on-keydown="_onToggleKeyDown"
disabled$="[[disabled]]"
aria-expanded$="[[_getAriaExpanded(opened)]]"
aria-controls$="[[_contentId]]"
>
<span part="toggle" aria-hidden="true"></span>
<span part="summary-content"><slot name="summary"></slot></span>
</div>

This has some implications related to focus management and screen reader announcements:

  1. The vaadin-tooltip overlay is not correctly announced because of Shadow DOM boundary,
  2. The expanded / collapsed state seems to be incorrectly announced by NVDA, see #152,
  3. We have to use a ShadowFocusMixin (only used by this component) to make focus work.

Describe the solution you'd like

Make breaking changes in the DOM structure of vaadin-details and vaadin-accordion-panel:

  1. By default, place the summary component in light DOM, like we do for e.g. vaadin-checkbox label,
  2. Convert the default summary component to vaadin-details-toggle with an icon stylable part,
  3. Add summary property to make it possible to create vaadin-details without using summary slot,
  4. Set id on the element passed to default slot (if not set by the user) for linking by aria-controls.

Additional context

We might want to also remove an element with heading role from vaadin-details Shadow DOM, but keep using it in case of vaadin-accordion-panel. See Why <details> is Not an Accordion for more context and related a11y implications.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions