I'm working on a website and I need to detect if the scrollbars have gutters or if they are in overlay mode. I was able to detect gutters and adjust my layout by checking offsetHeight
vs clientHeight
at initialization, but I would like to be able to detect it during navigation on the page ; for example, if scrollbars are overlay by default and the user changes its settings to always show them in gutters.
I tried various ways like ResizeObserver or MutationObserver to detect when my offset changes, but I can't get anything working.
What is the best way to dynamically detect scrollbar mode ?