Skip to content

Commit c4465de

Browse files
committed
Revert "Make sure to blur fields when user hits Done in settings"
This reverts commit 2caa320.
1 parent c366a6e commit c4465de

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,7 @@ const SettingsView = ({ onDone }: SettingsViewProps) => {
7070
const [modelIdErrorMessage, setModelIdErrorMessage] = useState<string | undefined>(undefined)
7171
const [commandInput, setCommandInput] = useState("")
7272

73-
const handleSubmit = async () => {
74-
// Focus the active element's parent to trigger blur
75-
document.activeElement?.parentElement?.focus()
76-
77-
// Small delay to let blur events complete
78-
await new Promise((resolve) => setTimeout(resolve, 50))
79-
73+
const handleSubmit = () => {
8074
const apiValidationResult = validateApiConfiguration(apiConfiguration)
8175
const modelIdValidationResult = validateModelId(apiConfiguration, glamaModels, openRouterModels)
8276

webview-ui/src/components/settings/__tests__/SettingsView.test.tsx

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { render, screen, fireEvent, waitFor } from "@testing-library/react"
1+
import React from "react"
2+
import { render, screen, fireEvent } from "@testing-library/react"
23
import SettingsView from "../SettingsView"
34
import { ExtensionStateContextProvider } from "../../../context/ExtensionStateContext"
45
import { vscode } from "../../../utils/vscode"
@@ -126,7 +127,7 @@ describe("SettingsView - Sound Settings", () => {
126127
expect(screen.queryByRole("slider", { name: /volume/i })).not.toBeInTheDocument()
127128
})
128129

129-
it("toggles sound setting and sends message to VSCode", async () => {
130+
it("toggles sound setting and sends message to VSCode", () => {
130131
renderSettingsView()
131132

132133
const soundCheckbox = screen.getByRole("checkbox", {
@@ -141,14 +142,12 @@ describe("SettingsView - Sound Settings", () => {
141142
const doneButton = screen.getByText("Done")
142143
fireEvent.click(doneButton)
143144

144-
await waitFor(() => {
145-
expect(vscode.postMessage).toHaveBeenCalledWith(
146-
expect.objectContaining({
147-
type: "soundEnabled",
148-
bool: true,
149-
}),
150-
)
151-
})
145+
expect(vscode.postMessage).toHaveBeenCalledWith(
146+
expect.objectContaining({
147+
type: "soundEnabled",
148+
bool: true,
149+
}),
150+
)
152151
})
153152

154153
it("shows volume slider when sound is enabled", () => {
@@ -166,7 +165,7 @@ describe("SettingsView - Sound Settings", () => {
166165
expect(volumeSlider).toHaveValue("0.5")
167166
})
168167

169-
it("updates volume and sends message to VSCode when slider changes", async () => {
168+
it("updates volume and sends message to VSCode when slider changes", () => {
170169
renderSettingsView()
171170

172171
// Enable sound
@@ -184,11 +183,9 @@ describe("SettingsView - Sound Settings", () => {
184183
fireEvent.click(doneButton)
185184

186185
// Verify message sent to VSCode
187-
await waitFor(() => {
188-
expect(vscode.postMessage).toHaveBeenCalledWith({
189-
type: "soundVolume",
190-
value: 0.75,
191-
})
186+
expect(vscode.postMessage).toHaveBeenCalledWith({
187+
type: "soundVolume",
188+
value: 0.75,
192189
})
193190
})
194191
})
@@ -305,7 +302,7 @@ describe("SettingsView - Allowed Commands", () => {
305302
expect(commands).toHaveLength(1)
306303
})
307304

308-
it("saves allowed commands when clicking Done", async () => {
305+
it("saves allowed commands when clicking Done", () => {
309306
const { onDone } = renderSettingsView()
310307

311308
// Enable always allow execute
@@ -325,14 +322,12 @@ describe("SettingsView - Allowed Commands", () => {
325322
fireEvent.click(doneButton)
326323

327324
// Verify VSCode messages were sent
328-
await waitFor(() => {
329-
expect(vscode.postMessage).toHaveBeenCalledWith(
330-
expect.objectContaining({
331-
type: "allowedCommands",
332-
commands: ["npm test"],
333-
}),
334-
)
335-
expect(onDone).toHaveBeenCalled()
336-
})
325+
expect(vscode.postMessage).toHaveBeenCalledWith(
326+
expect.objectContaining({
327+
type: "allowedCommands",
328+
commands: ["npm test"],
329+
}),
330+
)
331+
expect(onDone).toHaveBeenCalled()
337332
})
338333
})

0 commit comments

Comments
 (0)