pateketrueke / yrv

Your routing vibes! (for Svelte)
https://svelte.dev/repl/0f07c6134b16432591a9a3a0095a80de
161 stars 9 forks source link

Open in New Tab only works with Anchor Elements. #59

Closed theClarkSell closed 3 years ago

theClarkSell commented 4 years ago

@pateketrueke I know we just added #58 but we introduced a new issue that I'd be happy to fix.

Because we added the check for e.target.tagName === 'A' we limited ourselves to "only" handling the click on an anchor tag. But in cases like mine very often we're wrapping something in the anchor like so:

     <Link
        href="{l.href}"
      >
        <div class="flex items-center">
          <svg class="h-5" fill="currentColor" viewBox="0 0 20 20">
            <path d="M11 0h3L9 20H6l5-20z"></path>
          </svg>
          <span>{l.text}</span>
        </div>
      </Link>

ref: https://github.com/ThatConference/that.us/blob/master/src/components/nav/mainNav/Desktop.svelte#L11-L25

I think we should remove the check for A all together. The right thing should occur and bubble our since we're already taking our and binding our own onClick fuunciton.

Thoughts?