Index: misc/collapse.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/collapse.js,v
retrieving revision 1.28
diff -u -r1.28 collapse.js
--- misc/collapse.js	3 Mar 2010 19:46:25 -0000	1.28
+++ misc/collapse.js	20 Mar 2010 15:22:51 -0000
@@ -58,8 +58,9 @@
   attach: function (context, settings) {
     $('fieldset.collapsible', context).once('collapse', function () {
       var $fieldset = $(this);
-      // Expand if there are errors inside.
-      if ($('.error', $fieldset).length) {
+      // Expand fieldset if there are errors inside, or if it contains an
+      // element that is targeted by the uri fragment identifier. 
+      if ($('.error, :target', $fieldset).length) {
         $fieldset.removeClass('collapsed');
       }
 
