There was an error while loading. Please reload this page.
1 parent 6584b15 commit f55fdcfCopy full SHA for f55fdcf
1 file changed
src/components/DocFeedbackProvider.tsx
@@ -401,8 +401,12 @@ function BlockButton({
401
if (!portalContainer) {
402
portalContainer = document.createElement('div')
403
portalContainer.setAttribute('data-button-portal', blockId)
404
- portalContainer.className =
405
- 'absolute top-0 right-0 -translate-y-full z-[100]'
+ // Nudge down when following a <code> block so the button doesn't overlap with the code's top bar
+ const precedesCodeBlock = block.lastElementChild?.tagName === 'CODE'
406
+ portalContainer.className = twMerge(
407
+ 'absolute right-0 -translate-y-full z-[100]',
408
+ precedesCodeBlock ? 'top-6' : 'top-0',
409
+ )
410
portalContainer.style.position = 'absolute'
411
412
// Make the block relatively positioned if not already
0 commit comments