Skip to content

Dropdown improvements #1261

Open
Open

Description

@KOTungseth

Hidden content is not searchable

Content inside collapsed dropdowns is not searchable using browser-native search (cmd+f / ctrl+f). This negatively impacts usability, especially on pages with long lists of items hidden in dropdowns because users are unable to easily find the content they are looking for.

For example: https://www.elastic.co/docs/reference/query-languages/esql/esql-functions-operators
Using cmd+f to search for a specific function name does not work unless the dropdown containing that content is already expanded.

Proposal:
Ensure dropdown content is discoverable via browser search. Possible approaches:

  • Render all dropdown content in the DOM by default (even if visually collapsed)
  • Use accessible disclosure patterns (e.g.,
    / tags)
  • Explore JavaScript solutions that temporarily expand all dropdowns during a search

Dropdowns all collapsed by default

When a user lands on a page with multiple dropdowns, all sections are collapsed. This makes it unclear that the page contains expandable sections and can lead to confusion or missed content.

Proposal:
Automatically expand the first dropdown section on page load. This provides a visual cue that other sections can be expanded, helping users understand the interaction model of the page.

Activity

  1. added theissue type on Jul 11, 2025
  2. KOTungseth commented on May 14, 2026

    @KOTungseth
    ContributorAuthor

    This is coming up again on the Known issues pages.

  3. cotti commented on Jun 3, 2026

    @cotti
    Contributor

    AI triage

    Automated investigation against the current codebase. A human still needs to confirm before any code change.

    Original concern

    The {dropdown} directive bundles two reader-experience requests: collapsed dropdown content can't be found with browser-native search (cmd/ctrl+F), and pages full of collapsed dropdowns give no visual cue that sections are expandable (proposal: auto-expand the first one).

    Findings

    • src/Elastic.Markdown/Myst/Directives/Dropdown/DropdownView.cshtml:3-37 — the directive already renders as a native <details>/<summary> (one of the proposal's suggested "accessible disclosure" approaches). Content sits in the DOM but is hidden while collapsed.
    • src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs:352 & :369 — Open = block.DropdownOpen.GetValueOrDefault() ? "open" : null, so a dropdown is collapsed unless the author opts in. src/Elastic.Markdown/Myst/Directives/Admonition/AdmonitionBlock.cs:42-44 exposes that per-dropdown :open: option; docs/syntax/dropdowns.md:3 confirms "By default, dropdowns are collapsed." There is no auto-expand-first behavior.
    • Searchability of collapsed <details> is browser-dependent: Chromium (Chrome/Edge ≥120) auto-expands <details> during find-in-page, so concern Configure Renovate #1 already works there; Firefox/Safari do not. The repo is aware of the gap — src/Elastic.Documentation.Site/Assets/open-details-with-anchor.ts:6-22 force-opens <details> on anchor navigation specifically for non-Chrome browsers.
    • A working find-in-page pattern for collapsed content already exists, but only in the API Explorer: src/Elastic.Documentation.Site/Assets/api-docs.ts:7-8 and :141-167 use hidden="until-found" + beforematch (CSS at src/Elastic.Documentation.Site/Assets/api-docs.css:381-393). The {dropdown} directive does not reuse it — and note it is also Chromium-gated via onbeforematch, so it would not help Firefox/Safari either.
    • src/Elastic.Documentation.Site/Assets/main.ts:110-124 — the htmx:load init path wires openDetailsWithAnchor() and initApiDocs(), but nothing expands a page's first dropdown or expands all dropdowns during a search.

    Verdict

    Needs stakeholder input

    Neither requested behavior is implemented as asked, and both hinge on design decisions rather than a mechanical change. The <details> migration already gives Chromium-native find-in-page (partial mitigation of concern #1), but cross-browser searchability has no in-repo solution — the existing hidden="until-found" pattern is itself Chromium-only, so making Firefox/Safari work would require deciding on (and building) a real expand-on-search mechanism. The "auto-expand the first dropdown" idea is a pure interaction-design call with non-obvious downsides (pages like the ES|QL functions reference or the Kibana known-issues page may have a long or non-meaningful first entry). This is a vague catch-all worth splitting once scope is agreed.

    Proposal

    Open questions, grouped by audience:

    • UX / design — (1) Should the first dropdown auto-expand on every page, only when there's exactly one, or never (preferring an "Expand all / Collapse all" control instead)? (2) Is the acceptable bar for searchability "works in Chromium" (already true), or must Firefox/Safari be covered too? (3) Author, can you confirm the scope: is this primarily the long-list pages (ES|QL functions, Kibana known issues), or all {dropdown} usage site-wide?
    • Engineering — Given neither <details> find-expand nor hidden="until-found" works in Firefox/Safari, is a cross-browser expand-on-search even feasible (e.g. a JS hook on cmd/ctrl+F that force-opens every <details>), and is that worth the complexity vs. accepting Chromium-only? If "auto-expand first" wins, it would be a small addition either in DirectiveHtmlRenderer.WriteDropdown/AdmonitionBlock (first-in-page detection) or a one-liner in main.ts.

    Related issues

    • Provide expand all | collapse all buttons #241 (open) — "Provide expand all | collapse all buttons" — same expand/collapse discoverability theme but targets the sidenav, not body {dropdown} directives. Already triaged ai:ux-question; a coherent "expand/collapse all" answer could cover both surfaces.
    • [Feature Request]: Enable linking to dropdowns #1759 (open) — "Enable linking to dropdowns" — same <details> component, adjacent concern (anchor-into-dropdown), partly handled by open-details-with-anchor.ts.

    Notes

    • Concern Configure Renovate #1 may already be "good enough" for most users on Chromium today; worth confirming which browser the reporter tested before investing in a cross-browser fix.
    • Suggested follow-up: if maintainers accept scope, split Dropdown improvements #1261 into two issues (searchability vs. default-expand) so they can be decided/shipped independently.
  4. added
    ai-triaged
    ai:ux-question
    ai:eng-question
    on Jun 3, 2026
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

    ai-triagedai:eng-questionai:ux-question

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions