canonical / canonical/superhref
Clicking a superhref link loses the # part of the address
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## What happens
A page address can end with a `#` part. It marks a place on the page.
```
/docs?tab=api#install
```
A superhref link is only the query part:
```
?tab=faq
```
When you click it, the browser keeps the path and swaps the query part. But it also throws away the `#` part. You land on:
```
/docs?tab=faq
```
The `#install` is gone. Nobody asked to remove it. It just disappears.
This happens with every string superhref returns. It also happens with the bare `?` string that clears the query (added in #13).
## What should happen
The `#` part should stay unless someone removes it on purpose. Clicking `?tab=faq` on the page above should land on:
```
/docs?tab=faq#install
```
## Possible fix
`bind()` receives the whole URL, so it knows the `#` part. It could put the `#` part at the end of every string it returns:
```
?tab=faq#install
```
This needs a decision and tests.
Contributor guide
Research direction
Start with bind(), which receives the whole URL and produces the superhref strings; inspect how it handles the query and fragment portions. Add coverage for ?tab=faq and the bare ? when the current URL includes #install, and consider the issue complete when the fragment is preserved in both returned strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100