Skip to content

Add zoomable images feature#3127

Open
GuillaumeGomez wants to merge 4 commits into
rust-lang:masterfrom
GuillaumeGomez:zoom-in
Open

Add zoomable images feature#3127
GuillaumeGomez wants to merge 4 commits into
rust-lang:masterfrom
GuillaumeGomez:zoom-in

Conversation

@GuillaumeGomez
Copy link
Copy Markdown
Member

@GuillaumeGomez GuillaumeGomez commented May 26, 2026

Fixes #2075.

The "zoomed-in" image looks like this:

image

The JS is only used to "zoom out" images with the "escape key", otherwise the feature works entirely without JS.

It works as follows: there is a (hidden) checkbox right before the image. The image itself is inside the label associated to the checkbox, meaning that when you click on the image, you switch the value of the checkbox. And thanks to :checked CSS selector, it changes the display of the zoomed out image.

To make it obvious that you can "zoom in"/"zoom out" on an image, I changed the cursor to look like a loop using the CSS cursor: zoom-in|zoom-out property.

I also realized that images had the alt attribute, but not the title one, so I added it while I was at it.

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label May 26, 2026
@GuillaumeGomez
Copy link
Copy Markdown
Member Author

Updated failing tests as well, ready for review. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zoomable Images

2 participants