diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts
index 832725a9cda14..c85a825a958de 100644
--- a/src/services/refactors/extractSymbol.ts
+++ b/src/services/refactors/extractSymbol.ts
@@ -2002,6 +2002,6 @@ namespace ts.refactor.extractSymbol {
}
function isInJSXContent(node: Node) {
- return (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && isJsxElement(node.parent);
+ return (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent));
}
}
diff --git a/tests/cases/fourslash/extract-const_insideJsxFragment1.ts b/tests/cases/fourslash/extract-const_insideJsxFragment1.ts
new file mode 100644
index 0000000000000..bbde285183b05
--- /dev/null
+++ b/tests/cases/fourslash/extract-const_insideJsxFragment1.ts
@@ -0,0 +1,28 @@
+///
+
+// @jsx: preserve
+// @filename: a.tsx
+////function Foo() {
+//// return (
+//// <>
+//// /*a*//*b*/
+//// >
+//// );
+////}
+
+goTo.file("a.tsx");
+goTo.select("a", "b");
+edit.applyRefactor({
+ refactorName: "Extract Symbol",
+ actionName: "constant_scope_1",
+ actionDescription: "Extract to constant in global scope",
+ newContent:
+`const /*RENAME*/newLocal = ;
+function Foo() {
+ return (
+ <>
+ {newLocal}
+ >
+ );
+}`
+});