How to reproduce:
Run
mw.messages.set('test message', '[[#anchor|label]]'); mw.message('test message').parse();
at a wiki page.
Expected output:
"<a title=\"#anchor\" href=\"#anchor\">label</a>"
Actual output:
"<a title=\"#anchor\" href=\"/wiki/#anchor\">label</a>"
This makes it impossible to form anchor links from messages, while such use is natural when it comes to JavaScript tools. I've stumbled upon this in the Convenient-Discussions tool.
I'm aware of the limitations of using the messages API in JavaScript, but I believe this feature is important for scripts and not so hard to fix.