I've encountered an issue where the borders of widgets to be scrolled start appearing outside the ScrollView boundaries. This issue happens only when using KivyMD widgets (MDFloatLayout, MDBoxLayout, MDLinearProgressIndicator, etc.) with a background color.
The issue seems to be related to how KivyMD handles background color rendering compared to Kivy's native canvas instructions. Using regular Kivy widgets with canvas instructions properly constrains the background within the ScrollView.
For example, when I changed this:
MDFloatLayout:
size_hint: None, None
size: '42dp', '42dp'
md_bg_color: some_color
radius: 10
To this:
FloatLayout:
size_hint: None, None
size: '42dp', '42dp'
canvas.before:
Color:
rgba: some_color
RoundedRectangle:
size: self.size
pos: self.pos
radius: [10,] * 4
The issue disappeared.
Has anyone else encountered this?
I'm using: kivy 2.3.0, kivymd 2.0.1.dev0