Conversation
RHerheman
commented
Apr 6, 2026
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job implementing the core movement logic and handling page scroll correctly! Your use of getBoundingClientRect is a solid approach. However, I'm requesting a change because the current implementation doesn't fully support walls with different border sizes.
The code assumes all borders have the same width as the border-left-width. This leads to incorrect spider positioning if, for example, the border-top-width is different. This violates the requirement for the code to work with walls of any style.
To fix this, please adjust your calculations to account for individual border widths. You can get borderTopWidth and borderLeftWidth separately for the initial offset calculation. For the boundary checks, using the wall's clientWidth and clientHeight properties would be a more robust solution.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| const spiderRect = spider.getBoundingClientRect(); | ||
| const spiderW = spiderRect.width; | ||
| const spiderH = spiderRect.height; | ||
| const borderWidth = parseInt(getComputedStyle(wall).borderLeftWidth); |
There was a problem hiding this comment.
This line assumes all borders of the wall have the same width as the left border. This will cause incorrect positioning if, for example, border-top-width is different. The clickY calculation on line 19 and the boundary calculations on lines 23 and 27 will be wrong. It's better to get each border width property (borderTopWidth, borderRightWidth, borderBottomWidth) and use them in their respective calculations.