Skip to content

Commit f56dc21

Browse files
authored
Avoid Click to Load placeholders overflowing small containers (#332)
There are some situations where the containing element of a Click to Load placeholder is smaller than the placeholder. It can look kind of broken when the placeholder overflows the parent element. Let's try to work around that here.
1 parent 52cbbf9 commit f56dc21

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/features/click-to-load.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ async function createPlaceholderElementAndReplace (widget, trackingElement) {
446446
if (parseInt(placeholderHeight, 10) <= 200 || parseInt(parentHeight, 10) <= 200) {
447447
const titleRowTextButton = shadowRoot.querySelector(`#${titleID + 'TextButton'}`)
448448
titleRowTextButton.style.display = 'block'
449+
450+
// Avoid the placeholder being taller than the containing element
451+
// and overflowing.
452+
const innerDiv = shadowRoot.querySelector('.DuckDuckGoSocialContainer')
453+
innerDiv.style.minHeight = ''
454+
innerDiv.style.maxHeight = parentHeight
455+
innerDiv.style.overflow = 'hidden'
449456
}
450457
}
451458

0 commit comments

Comments
 (0)