The function getScrollParent
is designed to determine the nearest scrollable parent of a given HTML element.
The logic is particularly useful in web development when dealing with dynamic content that requires precise scrollbar management, such as with dropdowns or pop-up elements.