Many places erroneously use decodeURI or decodeURIComponent, however these will throw an exception if they encounter a unencoded % which is allowed by the spec, e.g.
> decodeURIComponent('%A') > Uncaught URIError: URI malformed
These errors have often just suppressed with a try/catch, and it is expected that fragments are generated fully encoded, however this is not always the case, and the escaping of user-generated inbound links is out of or control.
See also T106244
QA
The MobileFrontend Toggler ensures that if we link to a section of a page on mobile, the section gets automatically expanded. Note that opening the mobile site on a wide browser window will trigger "tablet mode" where sections are automatically expanded, so to test this you will need to open section links in a narrow browser window on the mobile site.
- Generate a link to a section of an article, e.g. by opening the site on desktop and copying a link from the table of contents
- Modify the link to be to mobile site
- Open the mobile link in a narrow window. Verify your section is scrolled to and the section opens.
- This should be tested with headings with various character sets (e.g. Arabic, Thai).
- Test this use case from a previous bug: https://en.wikipedia.beta.wmflabs.org/wiki/User:ESanders_(WMF)/sandbox#Romeo+Juliet_%A_%C3%93_%20
- Test that hash links on mobile with / still work, such as the link you get when the editor is open, e.g. #/editor/0 or when an image is viewed, e.g. #/media/File%3AParsoid_word_logo.svg