WICG / scroll-to-text-fragment

Proposal to allow specifying a text snippet in a URL fragment
Other
586 stars 43 forks source link

ʕ◔ᴥ◔ʔ :~: :~: :~: :~: :~: 𖠳 :~: :~: #245

Closed ImprovedTube closed 8 months ago

ImprovedTube commented 9 months ago

~:\~:~

so many characters. why not leave them away? (i know they are pretty)

hi guys, i also know i'm almost late to change the world-standard, yet very little time passed compared to how many people might still use it and how many years it was missing.

so:

#text

(=priority: anchor > text > parameters > regex)

¹: and/or: #FINDsomething to trigger a ctrl+F in the browser. Where to propose this?

Scrollmark

also can check if the anchor is just a percentage or amount of pixels (3-5 digits)

bokand commented 8 months ago

Thanks for your interest.

If no match in anchors is found, try text.

I believe this is essentially suggesting the fragmentation syntax and behavior. We did consider this early on (see #5) but decided against it. The reason being is that these kinds of links are meant to be generated by user agents (e.g. right click menu > copy link to text). Many pages on the web are built in such a way that an unexpected fragment-id In the URL can cause them to break (e.g. sometimes catastrophically, displaying an empty page). The user agent can't know whether a site will break with an unexpected fragment so we settled on the :~: syntax as a way to avoid this; the page doesn't see the fragment after :~:, hence why it's required.

¹: and/or: #FINDsomething to trigger a ctrl+F in the browser. Where to propose this?

The #:~:text=something directive is effectively that, though it doesn't (in any browser I'm aware) bring up the Ctrl-F UI. There's nothing stopping a browser from doing that though. If that's what you're suggesting, filing a feature request on a relevant browsers' bug tracker would probably the be most appropriate avenue.

Scrollmark

This is unlikely to work well in practice since content will appear differently on different devices, screen widths, etc. Even percentages won't point to the same content in cases of responsive layouts. Not to mention it makes the issue of stale links worse as pages change.