-
Notifications
You must be signed in to change notification settings - Fork 18
IMPROVE: Allow clicking on whole admonition title #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IMPROVE: Allow clicking on whole admonition title #29
Conversation
- In the javascript setup, also configure the whole admonition title element to be clickable. This happens only in the case where it is a direct descendent of the admonition box and there is only one admonition title descendent. - This is not designed to be perfect, but is designed to be mostly safe with most themes. It still could cause problems, but it has been tested with alabaster, sphinx_book_theme, and sphinx_rtd_theme.
|
Just wondering if this was noticed (I submitted it during the holiday times) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh I did miss this! But I think that it's a nice addition! Ideally we could do this purely with CSS, but I think adding the JS functionality is a nice step forward nonetheless.
I added a quick additional CSS rule so that the mouse becomes a "pointer" when you hover over toggle-able admonition titles, but other than that this seems good to go. I also removed some specific selectors for div so that this works with newer versions of sphinx/docuils
|
Let me know if my commits look good to you @rkdarst - then we can merge 👍 |
|
many thanks for this improvement @rkdarst ! |
This was inspired by the discussion in Improve toggle button design and structure #28, and having a bit of
spare time and wanting to try something. This gets the "admonition"
part of those design ideas.
In the javascript setup, also configure the whole admonition title
element to be clickable. This happens only in the case where it is
a direct descendent of the admonition box and there is only one
admonition title descendent.
This is not designed to be perfect, but is designed to be mostly
safe with most themes. It still could cause problems, but it has
been tested with alabaster, sphinx_book_theme, and sphinx_rtd_theme.
I don't claim to know javascript or CSS, or have deep knowledge of
sphinx-togglebutton. But I do know enough and could read and web
search enough to see how to add the onclick watcher + data to
identify the right thing to toggle.
Suggested reviews:
sense.
three themes above and firefox/chrome)
could be released and fixed later.