Hello!
Context
For XWIKI-22154, the document tree widget builds each node’s id straight from the entity reference, e.g. document:xwiki:A B.WebHome. A literal space in an HTML id is invalid.
Solution
The clean fix to this is escaping/unescaping the id everywhere the tree sends or receives it, and exposing the helper $.fn.xtree.unescapeNodeId() so other scripts can get the raw reference back easily. I found 6 places in xwiki-platform itself that read this id and parsed it as a reference (see the draft at PR #6205).
I looked for a way to leave the id untouched and only fix the rendered HTML attribute, but jsTree ties the two together internally: changing one without the other breaks clicking on tree nodes entirely. So the id format itself has to change.
Proposal
Treat this jsTree node id as internal, non-public API, and accept that any contrib extension or customization parsing it the same way our 6 xwiki-platform scripts did will need the same one-line fix.
Opinion
This id isn’t documented anywhere as public API, but the in-repo scripts relying on it shows it’s a de facto one, so this is worth discussing here
. A quick GitHub code search confirms this status: xwiki-contrib/application-filemanager sends tree.get_selected() straight to its own download job as a file path, and downloading a file with a space in its name would break with this fix. If this fix is agreed on, I’ll open a ticket on that project to make sure it’s kept up to date.
+1 from me for this somewhat breaking change: I don’t see a way to fix the HTML validity bug (that has real accessibility consequences) otherwise, and I’d rather make the compatibility break explicit (release note + the unescapeNodeId() helper) than leave the bug in place.
Conclusion
Do you know of additional contrib extension or customizations that rely on this raw node id format? Do you agree to break it? Should we mark it as API from now on or leave it as an in-between?
I’ll close this topic in a week if there’s no objection, and proceed from the proposed solution that can be found in #6205.
Thank you for your interest in the topic! I’m looking forward to your answers ![]()
Lucas C.