I encountered an issue where a scroll container that changes its size ends up with an incorrect _base_offset calculation.
Minimal reproduction steps:
- Enable visibility
- Resize the container so it becomes scrollable
- Scroll down to change pos
- Disable visibility
- Increase the container size so it is no longer scrollable
- Enable visibility and then disable it again
- Reduce the size
- Enable visibility
At this point, the bug occurs: content_node.position is now zero, but pos is still preserved.
As far as I was able to determine, this happens in _update_content_margins() when computing _base_offset = ScrollLayout.calculate_base_offset(content_node, pos)
As a temporary workaround, I completely replaced ScrollLayout.calculate_base_offset() with ScrollLayout.calculate_initial_offset(). This fixed the issue for me, but I’m not sure what side effects this change might have.
I encountered an issue where a scroll container that changes its size ends up with an incorrect
_base_offsetcalculation.Minimal reproduction steps:
At this point, the bug occurs:
content_node.positionis now zero, butposis still preserved.As far as I was able to determine, this happens in
_update_content_margins()when computing_base_offset = ScrollLayout.calculate_base_offset(content_node, pos)As a temporary workaround, I completely replaced
ScrollLayout.calculate_base_offset()withScrollLayout.calculate_initial_offset(). This fixed the issue for me, but I’m not sure what side effects this change might have.