Log inBook a Demo
BuildMidFrontendAuto-graded

Stop a virtual list clipping its last row

Make visible_window() return exactly the rows on screen, partial rows included, without crashing on short lists.visible_window() tells a virtualized list which rows to render for the current scroll position, plus the spacer above them and the full list height for the scrollbar. In the app, rows go missing or sit in the wrong place at the top and bottom of the viewport, and a list shorter than the screen crashes the consumer with an IndexError. Rewrite it so the window is right in every position, overscan included.
30 min
python

You're done when

  • A row only partly in view at the bottom edge is still rendered.
  • With overscan, the range stays inside the list at the very top and the very bottom.
  • The spacer above the rows matches the first rendered row, so every row sits in the right place.
  • The total height covers the whole list, so the scrollbar is the right size.

What it measures

Frontend developmentGetting the windowing math right, where one row off shows up straight away as a missing or misplaced row.
Frontend testingChecking the window at the edges: the first screen, the last screen and partial rows.
Boundary handlingKeeping every index inside the list at both ends, whatever the overscan.

Your environment

Terminal + editorA full shell in the browser
Coding agentAlready signed in, no API key to set up
Isolated workspaceOnly yours, wiped when you finish

Start this lab

30 min
Start labYou'll need to sign in to Anthropos first. The lab opens in a private cloud workspace with your coding agent ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo