Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nor4a created an issue. See original summary.

Nor4a’s picture

cilefen’s picture

Status: Active » Needs review
Issue tags: +JavaScript
Related issues: +#2743353: Contextual links double trigger

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

hampercm’s picture

Status: Needs review » Needs work
+++ b/core/modules/contextual/js/contextual.js
@@ -157,6 +157,7 @@
+        if ($.inArray($(this).attr('data-contextual-id'), ids) < 0)
         ids.push($(this).attr('data-contextual-id'));

Drupal coding standards require code blocks attached to if statements and loops to be surrounded by curly braces ({}), even if they're one line. Code blocks also must be indented. See https://www.drupal.org/docs/develop/standards/javascript/javascript-codi...

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
726 bytes
795 bytes

Syntax fixes, as requested.

Wim Leers’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

AFAICT this is not possible, because:

var $placeholders = $context.find('[data-contextual-id]').once('contextual-render');

That should ensure each of these is processed only once. So this needs a test to show how/when this breaks.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

JacobSanford’s picture

@DamienMcKenna's patch in #6 no longer applied to 8.5.x. A reroll with no further modifications is attached.

Anonymous’s picture

I ran into this effect. But #7 remark from Wim Leers led to an additional investigation. It is very likely, that the reason for the double trigger is the same ids of contextual links. I posted a patch in the issue describing it (#2891603-5: Contextual links can't handle multiple occurrences of the same contextual links (again)).

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

2pha’s picture

I have just come across this, Contextual links not opening.
What I have found is that....
One first page load they open and work fine.
One subsequent page loads, they do not open (but events are fired as I can see some classes being changed).
Under "Session Storage" in Chrome, you can see some "Drupal.contextual" items, when you delete these and reload the page, the contextual links will work again (but again, only for that page load, not subsequent page loads).

The contextual links that don't open for me are on titles output by a view.
The above fix / patches did not work for me.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Ludo.R’s picture

Patch #6 and #9 didn't work for me as well

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

komejo’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kerasai’s picture

Status: Needs work » Needs review
Issue tags: -JavaScript +JavaScript
FileSize
1.19 KB

At some point the data structure changed from just an array of the string IDs to an array of objects. Here is an updated version of the patch that adds an array to track which IDs have been seen, and returning early to avoid the double processing.

Applies cleanly to 8.7, 8.8, and 8.9.

kerasai’s picture

Ughh, missed a line from moving my own hacking into the existing approach.

Updated patch attached.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

u_tiwari’s picture

u_tiwari’s picture

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce, +Bug Smash Initiative

Can you please provide steps to reproduce, starting from 'install drupal'.

Cheers

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Thank you everyone on this.

If still a valid bug please reopen adding steps to reproduce

Thanks