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

Text shifts slightly when hovering over link in Firefox #487

Open
2 tasks done
Skepfyr opened this issue Feb 13, 2025 · 2 comments
Open
2 tasks done

Text shifts slightly when hovering over link in Firefox #487

Skepfyr opened this issue Feb 13, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@Skepfyr
Copy link

Skepfyr commented Feb 13, 2025

System information

zola 0.19.2
tabi v3.1.0 (also tested on main 05d042d)
firefox 135.0 (64-bit) on Linux (this doesn't appear to reproduce on Chromium)

Expected behaviour

When hovering over a link I expect the layout of the page to remain the same, this is true for most links but isn't always the case.

Actual behaviour

This picture most clearly shows the issue (purple lines added to highlight offset)
screenshot showing text offset on hover

I believe the issue occurs if the last character of a link and the next character overlap due to kerning/ligatures, in this example the r and the comma overlap when the link isn't being hovered over but they separate when it is. This pushes the rest of the line slightly right. I believe the font I'm ending up with is "Source Serif" but I'm not entirely sure about that.

Steps to reproduce

  1. Create a webiste using the tabi theme
  2. Add a page containing link which ends in an r and the next character is a comma (eg [link-r](http://example.com), foo)
  3. zola serve and open the page in Firefox
  4. Try hovering over the link in the page

Additional context

No response

Final checklist

  • I've checked that the issue isn't already reported.
  • I've tested with the latest version of tabi to check if the issue has already been fixed.
@Skepfyr Skepfyr added the bug Something isn't working label Feb 13, 2025
@welpo
Copy link
Owner

welpo commented Feb 16, 2025

Thanks for reporting this!

I can't reproduce on Firefox 135.0 on macOS nor on Windows:

Image

If you want to tinker, you could try editing either removing this block entirely:

tabi/sass/parts/_misc.scss

Lines 132 to 143 in 09e724a

a:not(.no-hover-padding):hover::before {
display: inline-block;
position: absolute;
z-index: -1;
inset-block-end: 0;
inset-block-start: 0;
inset-inline-end: -0.15em;
inset-inline-start: -0.15em;
background-color: var(--primary-color);
max-inline-size: 105%;
content: "";
}

(this is responsible for increasing the size of the background colour shift on hover)

or maybe just change the value of max-inline-size.

@Skepfyr
Copy link
Author

Skepfyr commented Feb 17, 2025

Huh, I think you "fixed" this between me raising the issue and you trying to reproduce! Specifically, because you're using ::before now instead of ::after (from #443 and therefore in v4.0.0) the reproducer I used no longer has the issue. I can still hit the same issue if the first character of the link overlaps with the character before, e.g. Reproducer[, weird link] foo but I suspect it's significantly less likely for anyone to hit that, because most links will be preceded by white space.

I'm not particularly bothered by this issue any more so feel free to do what you want with this bug report, it's still there but probably won't ever affect anyone.

(In the testing I ended up doing before I realised this, the issue appears to be caused by the pseudo-element existing with display: inline-block or position: absolute: if the pseudo-element didn't have both of those properties the issue disappeared)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants