python-docs-theme icon indicating copy to clipboard operation
python-docs-theme copied to clipboard

Add animations to the sidebar and other small places

Open Wulian233 opened this issue 1 year ago • 12 comments

I hope this theme isn't too stiff, let's make it more visually appealing :)

Added animations for showing/hiding the sidebar Color transition for sidebar buttons

It shouldn't affect normal usage, but it will make it more user-friendly👀

https://github.com/user-attachments/assets/ac0bd262-425a-454f-b338-a7eb8383e28e

The video has been compressed, so the animation might not look very smooth.

Wulian233 avatar Dec 20 '24 23:12 Wulian233

  • The sidebar animation -- from the video it looks like it has some issues, with the gray button lagging behind the rest when it's expanded. If this is fixed it might be ok to add it.

Thanks for the reminder, there is now a bug where the sidebar button is seen as part of the sidebar, causing it to be displayed at the end (lag) during the expanded animation. It should be pinned (split) out. I'll fix it tomorrow :)

Wulian233 avatar Dec 26 '24 12:12 Wulian233

Hi Hugo @hugovk , could you review this simple change, the effect of preview website is https://python-docs-theme-previews--210.org.readthedocs.build/en/210/ thanks!

Wulian233 avatar Jan 21 '25 11:01 Wulian233

Would be good if someone can give a quick check on Windows, Linux and iPhone.

hugovk avatar Jan 21 '25 11:01 hugovk

https://github.com/user-attachments/assets/39a1a09d-84d0-44fb-b862-9a157bc53605

It worked fine on my Android phone because sphinx doesn't have a sidebar button and comes with its own animation, so can only see smooth scrolling

Wulian233 avatar Jan 21 '25 11:01 Wulian233

Tested on iPhone. The scroll behaviour when clicking anchor links within a page seems fine, but it is a bit annoying to have a 'scroll' when loading a new page -- e.g. open this link in a new page: https://python-docs-theme-previews--210.org.readthedocs.build/en/210/glossary.html#term-docstring

A

AA-Turner avatar Jan 21 '25 16:01 AA-Turner

This is good advice, I tried it a few times and now the problem is finally solved. Clicking on an anchor point in the sidebar will smooth scrolling, and directly accessing a link with an anchor point will be pinned directly and will not scroll

https://python-docs-theme-previews--210.org.readthedocs.build/en/210/glossary.html#term-docstring https://python-docs-theme-previews--210.org.readthedocs.build/en/210/whatsnew/3.14.html#pep-761-discontinuation-of-pgp-signatures

Wulian233 avatar Jan 22 '25 02:01 Wulian233

Happy to see animations added if they're an improvement for most users, but for some, they are harmful. If you add the animations, could you turn them off for @media (prefers-reduced-motion)? Thanks.

encukou avatar Jan 22 '25 08:01 encukou

I've never thought about accessibility before, and I read the passage you gave me. I just now commit and theoretically these users will now disable the animation effect

edit: finished

Wulian233 avatar Jan 22 '25 08:01 Wulian233

Hmm, it is a little odd that when clicking to open the menu again, at first it shows the menu text before moving the divider back to the right. But maybe it doesn't matter?

image image image image

hugovk avatar Jan 24 '25 12:01 hugovk

Very carefully obviously. This animation only lasts for 0.3 seconds, and I didn't notice it 😂. I need to take a closer look at whether the text in the sidebar appears or disappears suddenly, without following the sidebar's animation. I'll check it out tomorrow and hope I can handle this little problem

Wulian233 avatar Jan 24 '25 14:01 Wulian233

Never mind! I'm also very willing to continue contributing to other aspects of this project. I just removed the fadeIn animation. Now there are only the imperfect sidebar animation and the color gradient of the hover sidebar button left. Feel free close/merge this pr at any time

Wulian233 avatar Jan 25 '25 03:01 Wulian233

All commit authors signed the Contributor License Agreement.

CLA signed

python-cla-bot[bot] avatar Apr 06 '25 13:04 python-cla-bot[bot]