Skip to content
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

feat: Unblur on click by default + add unblur on hover option #290

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

DokterKaj
Copy link
Contributor

When browsing on mobile, to reveal a blurred image, you have to press and hold until the open in new tab modal pops up, then tap off to see the image. It's far more intuitive to just tap on it to unblur it, but since the image is a link, doing that loads the webpage of the image.
This PR adds functionality for links to be disabled when blurred, for blurred content to be unblurred on click, and for links to be reenabled when unblurred. A new wrapper div around thumbnail images is required because pointer-events: none; also disables focusing on click.
I don't have much experience with Rust so any help with actually adding this option to the settings is welcome.

@DokterKaj
Copy link
Contributor Author

DokterKaj commented Oct 14, 2024

I realise now that taps do count as persistent hovers on mobile, so I could have gotten away with just reenabling pointer events on hover, but I'm too invested in this now I still think this is a useful option to have for desktop users.

EDIT: Never mind, links still open immediately after one tap with those rules added (although it prevents the open in new tab modal from popping up on long press).

@DokterKaj
Copy link
Contributor Author

DokterKaj commented Oct 16, 2024

@sigaloid I've made this option the new default since unblurring on hover doesn't work on mobile, if that's alright?
Also I'm sorry but I don't have much (read: any) experience with Rust so I'm not sure how to fix this bool/&bool error; I think it stems from the condition post_should_be_blurred && prefs.unblur_on_hover != "on" I added in the Rinja template but I don't see what's wrong with it 😓

@Kijewski
Copy link

Can you please have a look if changing post_should_be_blurred && … to *post_should_be_blurred && … does the trick?

@DokterKaj
Copy link
Contributor Author

@Kijewski looks like that did the trick, thanks! Will it have to be changed back if Rinja changes?

@Kijewski
Copy link

You won't have to change it back. The asterisk * won't be needed anymore, but it won't hurt, either.

@DokterKaj DokterKaj marked this pull request as ready for review October 17, 2024 10:20
@DokterKaj DokterKaj changed the title feat: Add unblur on click option feat: Unblur on click by default + add unblur on hover option Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants