Solved by CSS Scroll-Driven Animations: Detect if an element can scroll or not
on www.bram.usBecause Scroll-Driven Animations are only active when there is scrollable overflow, it is possible to use them as a mechanism to detect if an element can scroll or not.