Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-25537

expand macro expands all nested expands

XMLWordPrintable

      The expand-macro.js is pulling a list of all child elements rather than just taking the first one, adding .first() to the end of the expanderContent definition resolves this and allows inner expands to behave as expected.

      src:

      AJS.toInit(function ($) {
          // preload open image
          // contextPath will be expanded by the cssSubstituionTransformer
          new Image().src = "@contextPath/images/icons/grey_arrow_down.gif";
      
          function expand(e) {
              var expander = $(this),
                  expanderIcon = $(".expand-control-icon", expander),
                  expanderContent = $(".expand-content", expander.closest(".expand-container")).first();
      
              if (e.type == "click" || (e.type == "keyup" && e.keyCode == 13)) {
                  if (expanderContent.hasClass("expand-hidden")) {
                      // open
                      expanderContent.fadeIn("fast");
                  } else {
                      // close
                      expanderContent.fadeOut("fast")
                  }
                  
                  expanderContent.toggleClass("expand-hidden");
                  expanderIcon.toggleClass("expanded");
              }
          }
          
          $(".expand-control").click(expand).keyup(expand);
      });
      

            Unassigned Unassigned
            9fcfb21963e3 Alain Moran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: