🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

<display> docs say open/close cannot be animated; ::display-content (new) allows animation #42226

Closed
Khogendrarupini/content
#4

Description

@eivindeklund

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details

What specific section or headline is this issue about?

Try it

What information was incorrect, unhelpful, or incomplete?

The "Try it" section in the Elements/details page incorrectly says

You can use CSS to style the disclosure widget, and you can programmatically open and close the widget by setting/removing its open attribute. Unfortunately, at this time, there's no built-in way to animate the transition between open and closed.

(emphasis mine)

That sentence predates the import of MDN into github, and is no longer correct. The transition can be animated using ::details-content, which is in Baseline since September 2025.

What did you expect to see?

Something similar to

You can use CSS to style the disclosure widget, and you can programmatically open and close the widget by setting/removing its open attribute.

By default when closed, the widget is only tall enough to display the disclosure triangle and summary. When open, it expands to display the details contained within.

To animate the transition between open and closed, use the {{cssxref("::details-content")}} pseudo-element.

Do you have any supporting links, references, or citations?

::details-content w/example of transition for a details expand/collapse

Do you have anything more you want to share?

Proposed change to fix this: main...eivindeklund:mdn-content:patch-1

MDN metadata

Page report details

Activity

  1. added
    needs triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.
    on Dec 4, 2025
  2. Khogendrarupini commented on Dec 5, 2025

    @Khogendrarupini
    Contributor

    I would like to work on this issue.

  3. Josh-Cena commented on Aug 14, 2026

    @Josh-Cena
    Member

    Happy to take a PR. Also note, "Try it" should not have content; this whole section should be moved to a separate one titled "Usage notes" that's below "Events" and above "Examples".

  4. added
    accepting PRFeel free to open a PR to resolve this issue
    and removed
    Content:CSSCascading Style Sheets docs
    needs triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.
    on Aug 14, 2026
  5. BHUVANSH855 commented on Aug 18, 2026

    @BHUVANSH855
    Contributor

    Happy to take a PR. Also note, "Try it" should not have content; this whole section should be moved to a separate one titled "Usage notes" that's below "Events" and above "Examples".

    hi, I tried to do this in #45218

  6. Khogendrarupini commented on Oct 16, 2026

    @Khogendrarupini
    Contributor

    I have opened PR #4 to address this issue 👍

    The current documentation states that there is no built-in way to animate the opening and closing of the <details> element. This statement is now outdated, as the ::details-content pseudo-element enables CSS transitions for the disclosure content

    My change updates the documentation to reference ::details-content as the appropriate CSS mechanism for animating the transition between the open and closed states

    I have kept the changes focused on the reported issue, leaving the existing examples and unrelated documentation unchanged

    I hope this update helps keep the <details> reference accurate and aligned with current CSS capabilities. I'm happy to make any adjustments based on your feedback.

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

    Content:HTMLHypertext Markup Language docsaccepting PRFeel free to open a PR to resolve this issue

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions