From f83ae98461b068391f11b33a282e0b243b40d81b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Frank=20Na=CC=88gler?= <frank.naegler@typo3.org>
Date: Fri, 13 Nov 2015 12:25:32 +0100
Subject: [PATCH] [BUGFIX] CSH popup of main help icon not shown completely

Resolves: #71555
Releases: master
Change-Id: Iedc048a2dc393021a043aa0a819e0aac9c48f353
Reviewed-on: https://review.typo3.org/44703
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../Resources/Public/JavaScript/ContextHelp.js        |  5 +++++
 .../backend/Resources/Public/JavaScript/Popover.js    | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js
index 741f8cbe40fe..105dd436c577 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js
@@ -68,6 +68,11 @@ define(['jquery', 'TYPO3/CMS/Backend/Popover', 'bootstrap'], function($) {
 			} else if ($me.attr('data-loaded') === 'false' && $me.data('table')) {
 				ContextHelp.loadHelp($me);
 			}
+
+			// if help icon is in DocHeader, force open to bottom
+			if ($me.closest('.t3js-module-docheader').length) {
+				TYPO3.Popover.setOption($me, 'placement', 'bottom');
+			}
 		});
 		$(document).on('shown.bs.popover', ContextHelp.selector, function(evt) {
 			var $popover = $(evt.target).data('bs.popover').$tip;
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js b/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js
index e06c2e44144d..ad3689de5ce3 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js
@@ -60,6 +60,17 @@ define(['jquery', 'bootstrap'], function($) {
 			.popover(options);
 	};
 
+	/**
+	 * Set popover option on $element
+	 *
+	 * @param {Object} $element
+	 * @param {String} key
+	 * @param {String} value
+     */
+	Popover.setOption = function($element, key, value) {
+		$element.data('bs.popover').options[key] = value;
+	};
+
 	/**
 	 * Show popover with title and content on $element
 	 *
-- 
GitLab