You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve user experience in the user guide - make it clear to users that images are clickable #30596
In the user guide, it's not very noticeable that it's possible to click on images which then leads users to the example in which the respective image is used and explained in detail. For instance see here.
Suggest a potential alternative/fix
It would be good to find find a solution that makes it clear to users that there's a hyperlink attached to the images which leads to the respective examples. The discussion came up in PR #30127 which contributes to issue #26927.
@scikit-learn/contributor-experience-team @scikit-learn/documentation-team
I have missed that pictures might be clickable as well. Though I don't think that it had been too bad, since I am (like most people?) searching by text (inside-search or search bar) anyways when on the website.
Dimensions: A quick search for :target: ../auto_examples reveals that there might be 209 of such clickable images. Now, we could make these links explicit by duplicating them across the board or we could look at them one by one and evaluate if they add value to the file and make them explicit only then.
The first option is an overkill, I believe, and the second we're already doing in #26927. I would tend to trust this process.
I think if I'd be very interested in an image, I would see the cursor changes on them after a while.
I am not sure what the CSS above does so my suggestion may be redundant; what about a cursor tooltip with the text suggested above, that appears when you hover over the image?
I wanted to add a small text below such clickable images in the user guide. This text could be styled to be in italic and not as contrasted as the main text.
Maybe @Charlie-XIAO has an opinion on how we could make this work?
what about a cursor tooltip with the text suggested above, that appears when you hover over the image?
I find tooltips that follow the cursor a bit annoying personally. Furthermore, they do not help when browsing the doc on a mobile / tablet, or browsing on a desktop but without moving the mouse over the images of the doc (scrolling with the mouse with the cursor staying over the navigation panel).
This is the result after adding captions (the first alternative suggested by @Charlie-XIAO):
What I learned is that a blank line between the last directive option (:scale:) and the caption is necessary; otherwise, the figure will not appear in the HTML file.
The caption also looks good in different colour modes.
I also attempted to create a custom class for the figure directive in the doc/scss/custom.scss file to define hover behaviour, or add a frame around clickable images. However, none of these approaches worked (at least for the example above). I suspect this might be related to @Charlie-XIAO's comment:
psuedo-elements like :after won't work for <img>
as well.
If we decide to fix this for all clickable images, we could use the search method suggested by @StefanieSenger to manually update them on a large scale. It might be helpful to update the contributing guide to remind contributors during the creation or review of pull requests.
I agree this is an important UX improvement. Based on my experience in data visualization and UX, I'd suggest a minimally intrusive solution that maintains documentation clarity while improving discoverability:
Add a small icon (e.g., 🔍 or 🔗) next to clickable images using CSS:
Maybe an option is to re-use some of the styling that hyperlinks have when you hover them. I'm not a huge fan of borders around images but it seems like "similar interaction should look similar" is probably a good principle to follow?
I would rather do something less repetitive than text in every single image. I don't know if there is an easy way to do it, but I like the idea of a hover border, as it gives the image a button-like feeling.
Another possibility would be a slightly fade or reduced opacity whenever the user hoovers over the image.
This effect does make explicit that this image is clickable (consistent style with other links) which I like, but IMHO (1) It is still unclear what clicking this image leads to; we can add tooltip, but this might mean some sphinx hack or javascript. (2) Hover effects do not work for mobile devices or tablets, as also mentioned in #30596 (comment).
Light mode
Dark mode
Reacted by Olivier Grisel, Tim Head and Virgil Chan
I've been trying to google/perplexity.ai for what other websites do or what the recommendations are for letting people know that an image is a hyperlink. But haven't really found anything that is better than what we came up with in this thread :-/ A bit sad given that it seems like we haven't yet found the perfect solution/something everyone really likes
Hi, I’m Varshini. I recently made my first merged documentation PR in Jupyter Book.
I’d like to work on implementing the CSS solution discussed here (box-shadow + figure > a::after text).
Is it okay if I open a PR for this?
Activity
StefanieSenger commentedon Jan 7, 2025
I have missed that pictures might be clickable as well. Though I don't think that it had been too bad, since I am (like most people?) searching by text (inside-search or search bar) anyways when on the website.
Dimensions: A quick search for
:target: ../auto_examplesreveals that there might be 209 of such clickable images. Now, we could make these links explicit by duplicating them across the board or we could look at them one by one and evaluate if they add value to the file and make them explicit only then.The first option is an overkill, I believe, and the second we're already doing in #26927. I would tend to trust this process.
I think if I'd be very interested in an image, I would see the cursor changes on them after a while.
ogrisel commentedon Jan 7, 2025
I am aligned with the goal, but not sure what's the best way to achieve that.
ogrisel commentedon Jan 7, 2025
I was thinking about using a new CSS rule such as:
but this was not enough, and I could not make it work after a few back and forth tweaks with perplexity.
lucyleeow commentedon Jan 8, 2025
I am not sure what the CSS above does so my suggestion may be redundant; what about a cursor tooltip with the text suggested above, that appears when you hover over the image?
ogrisel commentedon Jan 8, 2025
I wanted to add a small text below such clickable images in the user guide. This text could be styled to be in italic and not as contrasted as the main text.
Maybe @Charlie-XIAO has an opinion on how we could make this work?
I find tooltips that follow the cursor a bit annoying personally. Furthermore, they do not help when browsing the doc on a mobile / tablet, or browsing on a desktop but without moving the mouse over the images of the doc (scrolling with the mouse with the cursor staying over the navigation panel).
Charlie-XIAO commentedon Jan 8, 2025
I'm afraid that psuedo-elements like
:afterwon't work for<img>so there might be no easy pure-CSS solution.Alternatives:
figuredirective to tweak what it generates. I'm not sure if this is possible (I will investigate).virchan commentedon Jan 8, 2025
This is the result after adding captions (the first alternative suggested by @Charlie-XIAO):
What I learned is that a blank line between the last directive option (
:scale:) and the caption is necessary; otherwise, the figure will not appear in the HTML file.The caption also looks good in different colour modes.
I also attempted to create a custom class for the
figuredirective in the doc/scss/custom.scss file to definehoverbehaviour, or add a frame around clickable images. However, none of these approaches worked (at least for the example above). I suspect this might be related to @Charlie-XIAO's comment:as well.
If we decide to fix this for all clickable images, we could use the search method suggested by @StefanieSenger to manually update them on a large scale. It might be helpful to update the contributing guide to remind contributors during the creation or review of pull requests.
StephenJudeD commentedon Jan 15, 2025
I agree this is an important UX improvement. Based on my experience in data visualization and UX, I'd suggest a minimally intrusive solution that maintains documentation clarity while improving discoverability:
Charlie-XIAO commentedon Jan 15, 2025
Well this is actually a good idea: though
:afterdoes not work forimgit does work forawhich I forgot to think about. With something likewe can achieve what @ogrisel wanted:
The rendering is slightly less satisfactory for images that already have a caption though:
betatim commentedon Jan 15, 2025
Maybe an option is to re-use some of the styling that hyperlinks have when you hover them. I'm not a huge fan of borders around images but it seems like "similar interaction should look similar" is probably a good principle to follow?
ogrisel commentedon Jan 15, 2025
Charlie's solution looks good to me.
ogrisel commentedon Jan 15, 2025
Not sure if changing img borders helps that much. I prefer explicit text.
ogrisel commentedon Jan 15, 2025
Maybe the
::aftertext could be shorter, e.g. "[source]" if people prefer.No strong opinion.
ArturoAmorQ commentedon Jan 15, 2025
I would rather do something less repetitive than text in every single image. I don't know if there is an easy way to do it, but I like the idea of a hover border, as it gives the image a button-like feeling.
Another possibility would be a slightly fade or reduced opacity whenever the user hoovers over the image.
Charlie-XIAO commentedon Jan 15, 2025
Border will cause movement - box shadow is probably what you are looking for.
This effect does make explicit that this image is clickable (consistent style with other links) which I like, but IMHO (1) It is still unclear what clicking this image leads to; we can add tooltip, but this might mean some sphinx hack or javascript. (2) Hover effects do not work for mobile devices or tablets, as also mentioned in #30596 (comment).
ogrisel commentedon Jan 16, 2025
Hover-based hints only is indeed useless on mobile / tablets or with people scrolling while keeping their mouse cursor over the side panel.
I would vote to do both the border / box-shadow thing + the after text.
betatim commentedon Jan 16, 2025
I've been trying to google/perplexity.ai for what other websites do or what the recommendations are for letting people know that an image is a hyperlink. But haven't really found anything that is better than what we came up with in this thread :-/ A bit sad given that it seems like we haven't yet found the perfect solution/something everyone really likes
Varshiniputtabakula commentedon Feb 9, 2026
Hi, I’m Varshini. I recently made my first merged documentation PR in Jupyter Book.
I’d like to work on implementing the CSS solution discussed here (box-shadow + figure > a::after text).
Is it okay if I open a PR for this?