Scroll to the right field

I’m using onClick in html to trigger a namedAction. The action reveals a form to fill out. I also want to set Focus so that the form is more clearly in view on a phone. I’m doing:
“showRegForm”: [{
“action”: “function”,
“function”: “model.accountType = ‘portal’”,
“options”: {}
}, {
“action”: “wait”,
“options”: {
“ms”: 1000
}
},{
“action”: “setFocus”,
“options”: {
“elementId”: “email”
}
}]

The model is updated and the form is revealed, but I’m hoping setFocus would cause the page to scroll down. Is this possible? Is the above the correct way to do that?

Thanks,
-jb

I’ve updated the subject to suit the request more.

For something like this you want to use some small JS in a function action.

const element = document.getElementById("my-input");  // this is the label name by default in BF
element.scrollIntoView();

You can get the exact id of the element by inspecting.

reference: Element: scrollIntoView() method - Web APIs | MDN