1
0
Fork 0

Prevent propagation from nested links

This commit is contained in:
Lim Chee Aun 2023-09-12 11:21:31 +08:00
parent 671c68b8f8
commit f5184bd608

View file

@ -39,6 +39,10 @@ const Link = forwardRef((props, ref) => {
{...restProps}
class={`${props.class || ''} ${isActive ? 'is-active' : ''}`}
onClick={(e) => {
if (e.currentTarget?.parentNode?.closest('a')) {
// If this <a> is nested inside another <a>
e.stopPropagation();
}
if (routerLocation) states.prevLocation = routerLocation;
props.onClick?.(e);
}}