code: function (summary) {
        var expanded = summary.__details.__summary.getAttribute('aria-expanded') === 'true'
        var hidden = summary.__details.__content.getAttribute('aria-hidden') === 'true'
  
        summary.__details.__summary.setAttribute('aria-expanded', (expanded ? 'false' : 'true'))
        summary.__details.__content.setAttribute('aria-hidden', (hidden ? 'false' : 'true'))
  
        if (!GOVUK.details.NATIVE_DETAILS) {
          summary.__details.__content.style.display = (expanded ? 'none' : '')
  
          var hasOpenAttr = summary.__details.getAttribute('open') !== null
          if (!hasOpenAttr) {
            summary.__details.setAttribute('open', 'open')
          } else {
            summary.__details.removeAttribute('open')
          }
        }
  
        if (summary.__twisty) {
          summary.__twisty.firstChild.nodeValue = (expanded ? '\u25ba' : '\u25bc')
          summary.__twisty.setAttribute('class', (expanded ? 'arrow arrow-closed' : 'arrow arrow-open'))
        }
  
        return true
      }
docs: Define a statechange function that updates aria-expanded and style.display Also update the arrow position