Skip to content

web: fix useScrollToLocationHash on hashes containing ":", ".", etc.

Warren Gifford requested to merge sg/scrolltolocation into main

Created by: slimsag

URL hashes may contain punctuation characters like :, ., ;, etc. and I intend to use them in API docs to make URL hashes nicer, e.g. #type:Router:Serve instead of #typeRouterServe.

This code previously used a CSS selector to match the relevant element by ID, but not all element IDs/URL hashes are valid CSS selectors: any containing punctuation are not.

This fixes it, by using getElementById which is better / more correct than composing a CSS selector for an ID anyway.

Signed-off-by: Stephen Gutekanst [email protected]

Merge request reports

Loading