hyper
hyper copied to clipboard
Using just a hash returns 'Link is not a valid URL.'
Describe the bug
Sometimes we just want to add a jump link on the page. I would expect to be able to add #jump-to-here as the input text on link field
Steps to reproduce
- Create a hyper field
- Add the following as a URL: `#my-custom-id
- Try to save the page
Craft CMS version
4.10.2
Plugin version
1.1.32
Multi-site?
No
Additional context
No response
It's correct behaviour that # is not a valid URL. We define a valid URL by it being an absolute URL. It's the reason why things like mailto: links won't work as a URL, because they're technically not.
For this reason, you'd pick a "Custom" link type that has no validation, and is essentially a general purpose link for you to have whatever you like in it.
My 2 cents: if the URL /some-path is considered valid, then #some-hash should be valid too.
@low Pretty sure it's just because we use the Yii UrlHelper which we just need to tweak further.