sphinx-design icon indicating copy to clipboard operation
sphinx-design copied to clipboard

Text in dropdown not reachable from searches

Open stefanodavid opened this issue 4 years ago • 2 comments

Describe the problem

I am not sure whether this is a bug, a design choice, or just something that I expected working differently.

Whenever you use dropdowns that are closed by default and search for text that is within the dropdown, that text is found but not shown. You need to manually open the dropdown to see the result.

Link to your repository or website

No response

Steps to reproduce

  1. Add the following to any source code page:
.. dropdown:: whatever

   this is a sentence with a twist

.. dropdown:: whatever
   :open:

   this is a sentence with a tweak
  1. search for tweak is OK and when you click on the search result, the text is shown
  2. search for twist is also OK, but when you click on the search result, the dropdown is shown and it is not immediate that the result is within the dropdown

The version of Python you're using

3.9.2 (but shouldn't matter)

Your operating system

Debian

Versions of your packages

sphinx-design 0.0.12 should be the only relevant package. I am using mostly themes based on sphinx-rtd-theme 1.0.0, but the same happens with other themes.

Additional context

I am using dropdown for example to separate steps in installation of a software, whenever there is a set of steps that need to be executed in order, or when writing the CLI reference of a bunch of commands. This means my dropdowns often contain quite a lot of text or CLI commands that a user might search for.

Hence, if this is not a bug, I'd appreciate if someone may provide a workaround or some alternative idea (although I admit I can't think of any, right now...). Otherwise, I will I need to drop the use of dropdowns and use something else instead, perhaps panels in a grid or the like.

stefanodavid avatar Nov 18 '21 11:11 stefanodavid

Heya, dropdowns use the standard <summary>+<details> HTML tags: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

So I imagine this is somewhat down to the browser, as to how it interacts with search and/or maybe the theme's implementation of search. So I don't think it's something that can be changed with this extension, but happy to receive suggestions/PRs if you do find a solution

chrisjsewell avatar Nov 18 '21 14:11 chrisjsewell

Hey Chris, thank for the quick and clear answer. I agree now that this "problem" does not depend on sphinx-design, so feel free to close this (non-)issue.

For the record, I still have not found a viable solution, but the link you provided gave me som hint. My best bet now would be to implement some javascript that opens dropdowns upon clicking a result (so according to the link, I should add a toggle event to details). Let's see if my coding abilities awake and support me :-) In the meanwhile, I will probably implement as workaround the :open: option to dropdowns (deadline's approaching...)

stefanodavid avatar Nov 23 '21 07:11 stefanodavid