mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 01:08:50 +01:00
Prevent propagation from nested links
This commit is contained in:
parent
671c68b8f8
commit
f5184bd608
1 changed files with 4 additions and 0 deletions
|
@ -39,6 +39,10 @@ const Link = forwardRef((props, ref) => {
|
||||||
{...restProps}
|
{...restProps}
|
||||||
class={`${props.class || ''} ${isActive ? 'is-active' : ''}`}
|
class={`${props.class || ''} ${isActive ? 'is-active' : ''}`}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
if (e.currentTarget?.parentNode?.closest('a')) {
|
||||||
|
// If this <a> is nested inside another <a>
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
if (routerLocation) states.prevLocation = routerLocation;
|
if (routerLocation) states.prevLocation = routerLocation;
|
||||||
props.onClick?.(e);
|
props.onClick?.(e);
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue