I have created a survey form where the user's name appears on top in mobile view. However, I am facing an issue with auto scroll when the keyboard pops up. I want to disable this feature to improve the user experience.
<input (click)="onFocusInput()" placeholder="" class="form-control" formControlName="name" required>
onFocusInput() {
//Method 1
window.scroll({
top: 100,
behavior: "smooth" // You can use "auto" instead of "smooth" for instant scrolling
});
//Method 2
// this.viewportScroller.scrollToAnchor("id1");
//Method 3
// const targetElement = document.getElementById("id1");
// if (targetElement) {
// targetElement.scrollIntoView({
// behavior: "smooth",
// block: "start",
// inline: "nearest"
// });
// }
}
I am looking for suggestions on how to customize the scroll behavior without the keyboard triggering an auto-scroll. Any help would be highly appreciated.