I know this is a really specific issue, but it's a mystery that annoys me.

The contextual links menu that allows me to edit articles is only showing up the first time I view it. By this, I mean, if I refresh the page, they will no longer work. If I click the edit tab, save the node and let it return me to the node's view page, they work again. But, then I refresh, and they are broken again.

I've noticed that the focus class is appended to the article (on hover) on the page when it works, but not when it doesn't work after being refreshed. I've also noticed by debugging that in StateModel.js and VisualView.js, that toggleOpen happens twice (on the broken version -- after refresh), opening and then closing the contextual links menu. But, I can't figure out why.

The content div, which contains the html for the article & contextual links, is 99% identical in bother versions with the only difference being a changed form-build-id for the comments.

The css/js files loaded on the page when it works/doesn't are nearly identical in both versions, with the only differences being a css file that does 2 unrelated things.

This is on both Firefox and Chrome.

If anyone has any ideas, it would really help me sleep at night.

  • 1
    My first guess is cache. Does this happen on your Dev machine as well (when cache is disabled)?
    – Eyal
    Commented Dec 24, 2016 at 9:05
  • Yes, I usually develop with browser caches disabled, and after reading your comment I tried disabling the cache using the services.yml, and the result was no different. I also tried doing drush cr between page loads, and there was no change in behavior. But, thanks to your comment, I thought of deleting the cookies, and that was it! I'm still working on figuring out why, but the cookie in the session storage called Drupal.contextual.node:node=4:changed=<sometimestamp>&langcode=en was what caused the toggle to run an extra time. Commented Dec 24, 2016 at 21:28
  • I also have just come across this. Contextual links open the first time, but not on subsequent page loads. Deleting the items Drupal.Contextual items from Session Storage in chrome, then reloading the page, and the contextual links work again. Core bug
    – 2pha
    Commented Jul 18, 2018 at 2:42

1 Answer 1


I figured out that someone else has hit this error, and has contributed a patch for it:


The patch stops the Contextual Links module from adding a contextual link placeholder to the array if it's already in there. I'm still not quite sure why there's a cookie for the contextual link (as I said in the comment above) if it's going through them and adding them anyway. If anyone else knows more about this issue, feel free to answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.