Skip to content

Conversation

johahor
Copy link
Member

@johahor johahor commented Nov 16, 2026

The sections on the home page were revealed when 15 % of the section was on the screen. With one book per row, "Top rated" is about 4270 px tall, so 641 px of it had to be visible at once. That does not fit in Safari on an iPhone 13 mini, so the section stayed hidden.

useInView now uses a margin instead of a threshold: an element is in view when it is 10 % into the screen. This does not depend on how tall the element is.

How it was tested

  • Chrome at 375 × 635 and 375 × 600: "Top rated" stayed hidden before the change and is revealed after it
  • Chrome at 365 × 600, 390 × 664 and 1280 × 680: all sections are revealed

Closes #153

@johahor johahor requested a review from a team as a code owner November 16, 2026 19:28
Copy link
Member

@martakam martakam left a comment •

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. 10% sounds resonable, but we could also adjust it to min(10% of real element height, predefined height that works on all devices)

Edit: I see now that you've mentioned it does not depend on the element height, so you can disregard the comment above

@johahor johahor merged commit 5a22131 into main Nov 16, 2026
8 checks passed
@hestro hestro added the bug Something isn't working label Nov 16, 2026
@hestro hestro added this to the Deliverable 4 milestone Nov 16, 2026
@martakam martakam deleted the fix/home-sections-on-short-screens branch November 16, 2026 20:06
Sign in to join this conversation on GitHub.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: bug with top rated books on smaller screens
3 participants