diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index 84bd0d1..0ab3d8c 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -2123,7 +2123,7 @@ function menu_contextual_links($module, $parent_path, $args) {
   $links = array();
   // Performance: In case a previous invocation for the same parent path did not
   // return any links, we immediately return here.
-  if (isset($path_empty[$parent_path])) {
+  if (isset($path_empty[$parent_path]) && strpos($parent_path, '%') !== FALSE) {
     return $links;
   }
   // Construct the item-specific parent path.
diff --git a/core/modules/contextual/contextual.info b/core/modules/contextual/contextual.info
index a006377..041f2e3 100644
--- a/core/modules/contextual/contextual.info
+++ b/core/modules/contextual/contextual.info
@@ -3,3 +3,4 @@ description = Provides contextual links to perform actions related to elements o
 package = Core
 version = VERSION
 core = 8.x
+files[] = contextual.test
diff --git a/core/modules/contextual/contextual.test b/core/modules/contextual/contextual.test
new file mode 100644
index 0000000..ffbc436
--- /dev/null
+++ b/core/modules/contextual/contextual.test
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @file
+ * Tests for contextual.module.
+ */
+
+/**
+ * Tests contextual links on node lists with different permissions.
+ */
+class ContextualDynamicContextTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Contextual links on node lists',
+      'description' => 'Tests if contextual links are showing on the front page depending on permissions.',
+      'group' => 'Contextual',
+    );
+  }
+
+  function setUp() {
+    parent::setUp(array('contextual', 'node'));
+    $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
+    $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
+    $web_user = $this->drupalCreateUser(array('access content', 'access contextual links', 'edit any article content'));
+    $this->drupalLogin($web_user);
+  }
+
+  /**
+   * Tests accessible links after inaccessible links on dynamic context.
+   */
+  function testNodeLinks() {
+    // Promote nodes to the front page. One article node the user can edit, one
+    // page node he can not edit and another article node he can edit.
+    $node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
+    $node2 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
+    $node3 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
+
+    // Now, on the front page, all article nodes should have contextual edit
+    // links. The page node in between should not.
+    $this->drupalGet('node');
+    $this->assertRaw('node/' . $node1->nid . '/edit', 'Edit link for oldest article node showing.');
+    $this->assertNoRaw('node/' . $node2->nid . '/edit', 'No edit link for page nodes.');
+    $this->assertRaw('node/' . $node3->nid . '/edit', 'Edit link for most recent article node showing.');
+  }
+}
