Skip to content

Search plugin: add "show-results" class to parent element when showing results #535

Closed
@jhildenbiddle

Description

@jhildenbiddle

When showing results, the search plugin adds a "show" class to certain elements to change styles. Specifically, it adds the "show" class the the clear button and the results panel:

<div class="search">
  <div class="input-wrap">
    <input type="search" value="" placeholder="Search...">
    <button class="clear-button show" aria-label="Clear search">...</button>
  </div>
  <div class="results-panel show">...</div>
</div>

It would be helpful to have this a class added to the search wrapper as follows:

<div class="search show-results">

Adding this class to the search wrapper will allow the sidebar navigation to be hidden when the search results are displayed using only CSS.

This functionality has been added to docsify-themeable by way of a small plugin, but ideally this would be handled by docsify out-of-the-box. Source code for the plugin can be viewed here:

(Making this change in the docsify source would be much easier than fixing this via plugin).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions