Disables link scroll on variant selection (#1109)

* Disables link scroll on variant selection

* Fix TS error
This commit is contained in:
Michael Novotny
2023-07-25 11:00:31 -05:00
committed by GitHub
parent 326f516138
commit 29aaa8cac6
2 changed files with 6 additions and 1 deletions

View File

@@ -107,10 +107,14 @@ export function VariantSelector({
)?.availableForSale;
const DynamicTag = isAvailableForSale ? Link : 'p';
const dynamicProps = {
...(isAvailableForSale && { scroll: false })
};
return (
<DynamicTag
key={value}
aria-disabled={!isAvailableForSale}
href={optionUrl}
title={`${option.name} ${value}${!isAvailableForSale ? ' (Out of Stock)' : ''}`}
className={clsx(
@@ -123,6 +127,7 @@ export function VariantSelector({
!isAvailableForSale
}
)}
{...dynamicProps}
>
{value}
</DynamicTag>