Assuming you want to auto scroll conditionally in JavaScript, you can use a div tag in the modal body to control the position.
Then in JS, set divElement.scrollLeft and/or divElement.scrollTop in pixel values to auto-move the scroll bars.
Your div tag needs the class slds-scrollable and depending on the modal content, you may need to set a height/width to show the horizontal and vertical bars.
Here is a simple modal component to illustrate this :
JS
import LightningModal from 'lightning/modal';
export default class Modal extends LightningModal {
handleOkay() {
this.close('okay');
}
handleScrollTop(){
let topDiv = this.refs.topDiv;
let divPos = topDiv.getBoundingClientRect();
topDiv.scrollLeft = divPos.x + 500; //scrolls on the middle on the modal
topDiv.scrollTop = 0; //scrolls at the top
}
handleScrollDown(){
let topDiv = this.refs.topDiv;
let divPos = topDiv.getBoundingClientRect();
topDiv.scrollLeft = divPos.x + 1200; //moves completely from its left edge.
topDiv.scrollTop = 1200; //scrolls at the bottom
}
}
HTML
<template>
<lightning-modal-header label="Modal header"></lightning-modal-header>
<lightning-modal-body>
<div lwc:ref="topDiv" class="slds-scrollable" style="height:15rem;">
<div class="slds-text-longform" style="width:200%">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</lightning-modal-body>
<lightning-modal-footer>
<lightning-button label="OK" onclick={handleOkay}></lightning-button>
<lightning-button label="Scroll top" onclick={handleScrollTop}></lightning-button>
<lightning-button label="Scroll down" onclick={handleScrollDown}></lightning-button>
</lightning-modal-footer>
</template>
As suggested by @Tobirama, used lwc:ref to easily get the top div element
slds-scrollable_x,slds-scrollable_y,slds-scrollableclasses