Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit 2ad959e

Browse files
committed
Prevent closing tags after self-closing JSX tags
FIX: Fix a bug that would cause self-closing JSX tags to have another closing tag inserted when typing the final '>'. Closes codemirror/dev#1339
1 parent ee3752b commit 2ad959e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/javascript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const autoCloseTags = EditorView.inputHandler.of((view, from, to, text, d
138138
}
139139
} else if (text == ">") {
140140
let openTag = findOpenTag(around)
141-
if (openTag &&
141+
if (openTag && openTag.name == "JSXOpenTag" &&
142142
!/^\/?>|^<\//.test(state.doc.sliceString(head, head + 2)) &&
143143
(name = elementName(state.doc, openTag, head)))
144144
return {range, changes: {from: head, insert: `</${name}>`}}

0 commit comments

Comments
 (0)