Skip to content

Commit 48b7d76

Browse files
committed
fix: improve UX by allowing users to empty mode name field
- Remove restriction that prevented users from emptying the name field - Remove onBlur handler that automatically restored original name - Allow backend validation to handle empty names and show appropriate errors - Users can now type freely but invalid saves are prevented by backend validation Addresses feedback from @daniel-lxs in PR #5767
1 parent 73c2f82 commit 48b7d76

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

webview-ui/src/components/modes/ModesView.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -730,25 +730,13 @@ const ModesView = ({ onDone }: ModesViewProps) => {
730730
const customMode = findModeBySlug(visualMode, customModes)
731731
if (customMode) {
732732
const newName = e.target.value.trim()
733-
// Only update if the name is not empty
734-
if (newName.length > 0) {
735-
updateCustomMode(visualMode, {
736-
...customMode,
737-
name: newName,
738-
source: customMode.source || "global",
739-
})
740-
}
741-
}
742-
}}
743-
onBlur={(e) => {
744-
const customMode = findModeBySlug(visualMode, customModes)
745-
if (customMode) {
746-
const newName = e.target.value.trim()
747-
// If the field is empty on blur, restore the original name
748-
if (newName.length === 0) {
749-
// Force re-render by updating the input value
750-
e.target.value = customMode.name
751-
}
733+
// Allow users to type freely, including emptying the field
734+
// The backend validation will handle empty names and show errors
735+
updateCustomMode(visualMode, {
736+
...customMode,
737+
name: newName,
738+
source: customMode.source || "global",
739+
})
752740
}
753741
}}
754742
className="w-full"

0 commit comments

Comments
 (0)