sphinx-design
sphinx-design copied to clipboard
Text in dropdown not reachable from searches
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
- 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
- search for tweak is OK and when you click on the search result, the text is shown
- 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.
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
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...)