NO BUG: bricksSmoothScroll - Uncaught DOMException: Document.querySelector: '#123-sezione' is not a valid selector

Browser: Firefox 110
OS: macOS
URL: Link to a page that illustrates this issue

I have a website with Table of Contents and some #link anchor section in the same page starts with numbers.
When I click to jump to the section I get this error:

Uncaught DOMException: Document.querySelector: ‘#123-sezione’ is not a valid selector bricks.min.js:1
** bricksSmoothScroll h ttps://try.bricksbuilder.io/t29555ba/wp-content/themes/bricks/assets/js/bricks.min.js?ver=1678009069:1**
** (Async: EventListener.handleEvent)**

I did some test on a clean installation on try.bricksbuilder.io and I get the same error of my website.

The sample page with error:

ID’s can’t start with numbers.

1 Like

I was looking for this example of Table of Contents and IDs starts with number, looks like this is working maybe there is some tricks as encoding the number as I saw in a css tricks blog post.

I did some test, if I remove the
function bricksSmoothScroll() from assets/js/bricks.min.js
The anchor jump works also if it start with number, as I saw in many TOC plugins.

Is there a easy way in Bricks Builder to unregister or remove the Smooth Scroll?
Thanks.

Hi Sandro,
We will remove the JS Smooth Scrolling in Bricks 1.7.1 and use the CSS approach instead. However, you will be able to disable it in the settings.

Basically, however, it is still the case that IDs must not begin with a number:

https://html.spec.whatwg.org/multipage/dom.html#global-attributes:the-id-attribute-2

Best regards,
timmse

1 Like

Thank you @timmse
for now I am using window.bricksSmoothScroll = () => false and css for smooth scroll.
I’ve got this from the FB Group.
:love_you_gesture:

1 Like