Problem/Motivation

When displaying the same entity twice on the same page but in different view modes (e.g. full + teaser), then the contextual links of neither entity work.

Proposed resolution

TBD.

Debugging so far yielded this:

  • each entity is assigned an entity instance ID correctly, each appears to be initialized correctly
  • there is some double binding going on, which causes a click on the contextual links to call the click event handler twice, thus opening/closing it in quick succession, effectively making the contextual links seem broken (non-responsive)
  • also see that only one of the two entities actually has an EntityModel in Drupal.quickedit.collections.entities.models

So likely the double-binding is due to the second entity not being handled correctly somewhere, likely in the final stages entity initialization.

Remaining tasks

Debug.

User interface changes

None.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Issue summary: View changes
FileSize
1.2 KB
dawehner’s picture

I hope that patch isn't the proper fix :)

Wim Leers’s picture

Haha, no, not at all! It's only to easily reproduce the problem, as the file name suggests.

If I'd actually propose this, I'd also give you the right to deny me french fries + mayonaise for the rest of my life :D

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

sittard’s picture

This bug or similar appears to be present in Drupal 8.2.1 and Drupal 8.3.x-dev

Steps to reproduce:

  1. Create a number of Basic page nodes for testing
  2. Create a view as a block with the format content rendered as a teaser. Set the pager to display all items
  3. Place the views block in the sidebar region with visibility set so that it appears on a Basic page node
  4. Go to any Basic page node. It is not possible to access the quick edit menu for the node being viewed or the same node in the sidebar region.

Attached are some screen shots to help highlight the issue.

Berdir’s picture

Is the different view modes thing actually relevant? Doesn't it happen the same if you display it twice using the same view mode?

I know we fixed some bugs related to EntityModel when the same entity is present more than once on a page. We were running into that case for some of our sites.

sittard’s picture

No it would appear that the view mode is irrelevant. I recreated a page using the same view mode twice (see attached screenshot). But it appears just having a duplicate node on the screen is enough to disable the contextual menu functionality.

Wim Leers’s picture

Title: Displaying the same entity twice on one page, but in different view modes, doesn't work as expected » [PP-1] Displaying the same entity twice on one page, but in different view modes, doesn't work as expected
Status: Active » Postponed
Issue tags: +Needs tests
Related issues: +#2828528: Add Quick Edit Functional JS test coverage

Only once we have #2828528: Add Quick Edit Functional JS test coverage, we will be able to write sane test coverage. I've specifically thought about multiple instances in the test class, so that it's easy to add test coverage for this use case here.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

geerlingguy’s picture

Just spent an hour trying to track this down. In my case, I have a node rendered three times—teaser, contact, and accordion display modes—on one other referenced node's full view mode. I was banging my head against a wall seeing that all the markup was correct until I realized that if I rendered any of these three instances individually, everything worked great. But if I rendered two or more, none of the contextual buttons worked at all!

Other quickedit/contextual links are working fine on that same page, so luckily it's only the entity that's rendered three times that's breaking.

This is definitely a confusing behavior—is it possible we could get a fix in without waiting on a new testing system, if the fix can (for now, at least) be manually tested/verified? We could then open a follow-up issue to get a proper test in after #2828528: Add Quick Edit Functional JS test coverage is complete.

[Edit: A tiny bit more debugging found that the node being rendered three times would get entityInstanceID's of 0, then 0, then 1.]

geerlingguy’s picture

So... my particular problem was due to a bug in the Block Styles module (#2867873: Block Styles 'block--clean.html.twig' template doesn't print attributes, to be precise), and once I fixed that (made sure attributes were printed in it's custom block template), all the links worked great, and quirks went away.

So I think this goes back (yet again) to #2551373: contextual.js and quickedit.js should fail gracefully, with useful error messages, when Twig templates forget to print attributes, which I think I've run into on every D8 site I've been involved with so far.

mlahde’s picture

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

Just checked that this still exists in 8.4.x-dev. Changed version status.

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.

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.

Wim Leers’s picture

Title: [PP-1] Displaying the same entity twice on one page, but in different view modes, doesn't work as expected » Displaying the same entity twice on one page, but in different view modes, doesn't work as expected
Status: Postponed » Needs work
Issue tags: +Needs JavaScript testing

#2828528: Add Quick Edit Functional JS test coverage landed! Now tests are totally feasible to write. Let's get this done!

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.

mcrittenden’s picture

Title: Displaying the same entity twice on one page, but in different view modes, doesn't work as expected » Displaying the same entity twice on one page doesn't work as expected

Fixing title to make it more clear that the issue is reproducible when using the same view mode rather than only being a problem when using different view modes.

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.

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.

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.

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.

Spokje’s picture

Project: Drupal core » Quick Edit
Version: 9.4.x-dev » 1.0.x-dev
Component: quickedit.module » Code

Due to Quickedit being moved out of Drupal Core and into a Contrib Module, moving this issue to the Contrib Module queue.