sveltejs / sveltejs/kit

Sveltekit filebase router uses anchor click events. So do not stop propagation of these events.

Open
#4,347 11 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

p2-nice-to-have
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

I used a click event in a pulldown menu components of a NavBar to close the pulldown after a menu item was clicked.
The click handler in the pulldown menu component used stopPropagtion. Doing so the click event could not reach the filebased router and the browser took over.

This should in my opinion be clear in the docs.

Reproduction

Block the click bubble using stopPropagation of routing anchors

Logs

No response

System Info
Not applicable
Severity

annoyance

Additional Information

Took me a couple of hours to find out why the Svelkit router ignored the anchor click of items in the pulldown menu.
For the pulldown menu component I used code, which worked fine in a Svelte project using my own hash router.
But the Sveltekit file-based router uses clicks to route.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No documentation file or test is named in the issue. Start by locating the SvelteKit documentation for anchor-based routing and click handling, then document that routing anchor clicks must not be stopped with stopPropagation. Done means the relevant guidance clearly explains why the file-based router needs the click event to reach it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.