summaryrefslogtreecommitdiffstatshomepage
path: root/core/misc/vertical-tabs.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/misc/vertical-tabs.js')
-rw-r--r--core/misc/vertical-tabs.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/misc/vertical-tabs.js b/core/misc/vertical-tabs.js
index 3b628bf2fba2..9d2e955fc828 100644
--- a/core/misc/vertical-tabs.js
+++ b/core/misc/vertical-tabs.js
@@ -85,8 +85,13 @@
$details.each(function () {
const $that = $(this);
const $summary = $that.find('> summary');
+ // Summary elements often have 2 child nodes: a text title and a
+ // dynamic summary wrapped in <span>. To set the vertical tab title,
+ // we only want to copy the summary title, which is the first child
+ // node.
+ const title = $summary[0]?.firstChild?.textContent || '';
const verticalTab = new Drupal.verticalTab({
- title: $summary.length ? $summary[0].textContent : '',
+ title,
details: $that,
});
tabList.append(verticalTab.item);