From 31d939e9caeb93de5f8a1275bf618acedb2410bb Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin <30870051+Sebastien-Ahkrin@users.noreply.github.com> Date: Tue, 11 Aug 2026 21:09:44 +0200 Subject: [PATCH 1/3] fix(prevent-link-loss): mount banner outside the fieldset Closes: https://github.com/refined-github/refined-github/issues/9955 --- source/features/prevent-link-loss.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/features/prevent-link-loss.tsx b/source/features/prevent-link-loss.tsx index d186dce9329e..15b2fc7574a7 100644 --- a/source/features/prevent-link-loss.tsx +++ b/source/features/prevent-link-loss.tsx @@ -14,12 +14,11 @@ function attach(field: HTMLTextAreaElement): void { // Editing PR body '.CommentBox', ], field); - mount(Banner, { - target, - props: { - field, - }, - }); + + const wrapper = document.createElement('div'); + target.after(wrapper); + + mount(Banner, { target: wrapper, props: { field } }); } function init(signal: AbortSignal): void { From f4585bbf4abf1c03eb7bad883dc1d1218b282aa9 Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin <30870051+Sebastien-Ahkrin@users.noreply.github.com> Date: Tue, 11 Aug 2026 21:41:51 +0200 Subject: [PATCH 2/3] refactor: do not create a new div --- source/features/prevent-link-loss.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/features/prevent-link-loss.tsx b/source/features/prevent-link-loss.tsx index 15b2fc7574a7..b99f860ad8d5 100644 --- a/source/features/prevent-link-loss.tsx +++ b/source/features/prevent-link-loss.tsx @@ -15,10 +15,10 @@ function attach(field: HTMLTextAreaElement): void { '.CommentBox', ], field); - const wrapper = document.createElement('div'); - target.after(wrapper); - - mount(Banner, { target: wrapper, props: { field } }); + mount(Banner, { + target: target.parentElement!, + anchor: target.nextSibling ?? undefined, props: {field}, + }); } function init(signal: AbortSignal): void { From de823dac37f46d605b520a7648cf6b76d992a08c Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin <30870051+Sebastien-Ahkrin@users.noreply.github.com> Date: Wed, 12 Aug 2026 00:16:46 +0200 Subject: [PATCH 3/3] fix: mount banner outside fieldset only on new markdown editor --- source/features/prevent-link-loss.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/features/prevent-link-loss.tsx b/source/features/prevent-link-loss.tsx index b99f860ad8d5..80ea544ccaee 100644 --- a/source/features/prevent-link-loss.tsx +++ b/source/features/prevent-link-loss.tsx @@ -15,9 +15,23 @@ function attach(field: HTMLTextAreaElement): void { '.CommentBox', ], field); + if (target instanceof HTMLFieldSetElement) { + // On the new Markdown editor mounting a child directly inside the `fieldset` collapses + // its height to 0, hiding the textarea entirely. Mounting as a sibling instead avoids the issues. + // https://github.com/refined-github/refined-github/issues/9955 + mount(Banner, { + target: target.parentElement!, + anchor: target.nextSibling ?? undefined, props: {field}, + }); + + return; + } + + // Old Markdown editor doesn't have this bug, so we can keep mounting inside it. + // This also preserve the extra margin for old views (PR) mount(Banner, { - target: target.parentElement!, - anchor: target.nextSibling ?? undefined, props: {field}, + target, + props: {field}, }); }