Scrollbar gutter component
This provides an API and adds a
--scrollbar-gutter
custom property to the <html>
element with the detected thickness of the scrollbar, which is updated lazily on viewport resize. This is based on a technique by David Walsh, as demonstrated in this JSFiddle. Once the scrollbar-gutter
CSS property is supported in all major browsers, this component may become unnecessary.