Scroll to the top list item without scrolling the view – ReactJS

I want to scroll to an item in the list, but when I click on the item my entire view scrolls. I would like the scroll to be only for the div with the list.

<AlertsList>
        {productInventoryAlert?.map((product, index) => {
          const itemRef = createRef<HTMLLIElement>();

          const handleScrollIntoView = (index: number) => {
            if (expandedCard === index) {
              setExpandedCard(-1);
            } else {
              setExpandedCard(index);
            }

            itemRef.current?.scrollIntoView(true);
          }

          return (
            <li ref={itemRef} key={index}>
              <DashboardInventoryAlertListItem
                handleScrollIntoView={handleScrollIntoView}
                product={product}
                index={index}
                expandedCard={expandedCard}
              />
            </li>
          );
        })}
</AlertsList>

export const AlertsList = styled.ul`
  max-height: 250px;
  overflow: scroll;
  list-style: none;
  scroll-behavior: smooth;
 `;