diff --git a/facets.module b/facets.module
index 75d4b09..3ed78a3 100644
--- a/facets.module
+++ b/facets.module
@@ -324,11 +324,12 @@ function facets_system_breadcrumb_alter(Breadcrumb &$breadcrumb, RouteMatchInter
         $facet_url = $res->getUrl();
         /** @var \Drupal\Core\Url $facet_url */
         $query = $facet_url->getOption('query');
-        $source_filter = isset($query[$facet_source->getFilterKey()]) ? $query[$facet_source->getFilterKey()] : [];
+        $filter_key = $facet_source->getFilterKey() ?: 'f';
+        $source_filter = $query[$filter_key];
         $source_filter = array_unique($source_filter);
         $source_filter = array_filter($source_filter);
         $matches = preg_grep('/^' . implode('|^', $facet_used_result) . '/', $source_filter);
-        $query[$facet_source->getFilterKey()] = $matches;
+        $query[$filter_key] = $matches;
         $facet_crumb_items[] = $res->getDisplayValue();
       }
 
diff --git a/tests/src/Functional/BreadcrumbIntegrationTest.php b/tests/src/Functional/BreadcrumbIntegrationTest.php
index ac2a710..ae58458 100644
--- a/tests/src/Functional/BreadcrumbIntegrationTest.php
+++ b/tests/src/Functional/BreadcrumbIntegrationTest.php
@@ -48,16 +48,7 @@ public function setUp() {
    * Tests Breadcrumb integration with grouping.
    */
   public function testGroupingIntegration() {
-    $this->drupalGet('admin/config/search/facets');
-    $this->clickLink('Configure', 1);
-    $edit = [
-      'filter_key' => 'f',
-      'url_processor' => 'query_string',
-      'breadcrumb[active]' => TRUE,
-      'breadcrumb[group]' => TRUE,
-    ];
-    $this->drupalPostForm(NULL, $edit, 'Save');
-
+    $this->editFacetConfig();
     $id = 'keywords';
     $name = 'Keywords';
     $this->createFacet($name, $id, 'keywords');
@@ -71,6 +62,42 @@ public function testGroupingIntegration() {
     $this->drupalGet('admin/config/search/facets/' . $id . '/edit');
     $this->drupalPostForm(NULL, ['facet_settings[weight]' => '1'], 'Save');
 
+    // Test with a default filter key.
+    $this->editFacetConfig(['filter_key' => 'f']);
+    $this->breadcrumbTest();
+
+    // Test with an empty filter key.
+    $this->editFacetConfig(['filter_key' => '']);
+    $this->breadcrumbTest();
+
+    // Test with a random filter key.
+    $this->editFacetConfig(['filter_key' => $this->randomMachineName()]);
+    $this->breadcrumbTest();
+  }
+
+  /**
+   * Edit the facet configuration with the given values.
+   *
+   * @param array $config
+   */
+  public function editFacetConfig(array $config = []) {
+    $this->drupalGet('admin/config/search/facets');
+    $this->clickLink('Configure', 1);
+    $default_config = [
+      'filter_key' => 'f',
+      'url_processor' => 'query_string',
+      'breadcrumb[active]' => TRUE,
+      'breadcrumb[group]' => TRUE,
+    ];
+    $edit = array_merge($default_config, $config);
+    $this->drupalPostForm(NULL, $edit, 'Save');
+  }
+
+  /**
+   * Tests Breadcrumb with the given config.
+   */
+  public function breadcrumbTest() {
+
     // Breadcrumb should show Keywords: orange > Type: article, item
 
     $initial_query = ['search_api_fulltext' => 'foo', 'test_param' => 1];
