It’s because it can’t find the element in the page, and you can’t call scrollIntoView
on null
.
Are you testing this inside the workflow editor or in preview mode?
The context of the workflows is different if you execute the in the workflow editor or in preview.
The document
in the preview is your app document, while in the workflow editor it’s the weweb’s editor document and your element is not here.
Because this action is scrolling the page there is no real use in testing it in the workflow editor.
Try testing it in preview mode.
If you still get the same error then it’s because your element is rendered into the page after the execution of your workflow. This can happen sometimes with modals.
If this is the case you may need something different to select your element, for example an intersectionObserver
like in this post.
Anyway accessing an element directly in a vue app is considered an anti-pattern.
In your nocode try did you bind the id of the section to the link? Maybe this can have rush conditions and work erratically.
Anyway an action for scrolling inside a workflow can be useful.