Replies: 1 comment
-
That would scroll until the button is visible in the viewport. Since it's already visible, the scroll position remains unchanged.
There's no built-in shortcut to say "scroll by the height of a row". You can configure your custom scrolling behavior as a function, like this: const ROW_HEIGHT = 30
up.on('up:form:submit', function(event) {
if (event.submitButton?.matches('.add-row')) {
event.renderOptions.scroll = function() {
document.scrollingElement.scrollTop += ROW_HEIGHT
}
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have the above form setup. When I click "Add Row" the field is added above the "Add Row" button and the button moves down. I'd like to keep the button in it's existing scroll position under the user's cursor which would move the rest of the content up and out of the top of the viewport.
I thought
up-scroll="button"might work for this but I'm apparently not groking how to use it.Is there a right incantation of attributes to get this behavior?
Also, this behavior only applies for the "Add Row" button. If the main submit button is rendered, then I'd like the form to redirect to a new page.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions