diff --git a/core/misc/collapse.js b/core/misc/collapse.js
index 1ad89f7..62cd0dd 100644
--- a/core/misc/collapse.js
+++ b/core/misc/collapse.js
@@ -20,7 +20,7 @@
     // Expand details if there are errors inside, or if it contains an
     // element that is targeted by the URI fragment identifier.
     var anchor = location.hash && location.hash !== '#' ? ', ' + location.hash : '';
-    if (this.$node.find('.error' + anchor).length) {
+    if (this.$node.find('.error' + anchor.replace(/[=%;,\/]/g, "_")).length) {
       this.$node.attr('open', true);
     }
     // Initialize and setup the summary,
