diff --git a/src/frontend/components/_organisms/variables-editor/__tests__/return-type-visibility.test.tsx b/src/frontend/components/_organisms/variables-editor/__tests__/return-type-visibility.test.tsx
new file mode 100644
index 000000000..510601d1a
--- /dev/null
+++ b/src/frontend/components/_organisms/variables-editor/__tests__/return-type-visibility.test.tsx
@@ -0,0 +1,64 @@
+import { render, screen } from '@testing-library/react'
+
+// The variables code editor pulls in Monaco, which cannot run in jsdom.
+vi.mock('@root/frontend/components/_organisms/variables-code-editor', () => ({
+ VariablesCodeEditor: () =>
,
+}))
+
+import { useOpenPLCStore } from '../../../../store'
+import { VariablesEditor } from '../index'
+
+const createPou = (
+ name: string,
+ type: 'program' | 'function' | 'function-block',
+ language: 'st' | 'fbd' | 'ld' | 'sfc',
+) => {
+ const result = useOpenPLCStore.getState().pouActions.create({ type, name, language })
+ expect(result.ok).toBe(true)
+}
+
+// https://github.com/Autonomy-Logic/openplc-editor/issues/696
+describe('VariablesEditor return type selector', () => {
+ it('shows the return type selector for a function written in FBD', () => {
+ createPou('FbdFunction', 'function', 'fbd')
+ render()
+ expect(screen.getByText('Return type :')).toBeTruthy()
+ })
+
+ it('shows the return type selector for a function written in LD', () => {
+ createPou('LdFunction', 'function', 'ld')
+ render()
+ expect(screen.getByText('Return type :')).toBeTruthy()
+ })
+
+ it('shows the return type selector for a function written in SFC', () => {
+ createPou('SfcFunction', 'function', 'sfc')
+ render()
+ expect(screen.getByText('Return type :')).toBeTruthy()
+ })
+
+ it('associates the return type label with its select trigger', () => {
+ createPou('LabeledFunction', 'function', 'fbd')
+ render()
+ const trigger = screen.getByLabelText('Return type :')
+ expect(trigger.id).toBe('return-type')
+ })
+
+ it('shows the return type selector for a function written in ST', () => {
+ createPou('StFunction', 'function', 'st')
+ render()
+ expect(screen.getByText('Return type :')).toBeTruthy()
+ })
+
+ it('does not show the return type selector for an FBD program', () => {
+ createPou('FbdProgram', 'program', 'fbd')
+ render()
+ expect(screen.queryByText('Return type :')).toBeNull()
+ })
+
+ it('does not show the return type selector for an FBD function block', () => {
+ createPou('FbdBlock', 'function-block', 'fbd')
+ render()
+ expect(screen.queryByText('Return type :')).toBeNull()
+ })
+})
diff --git a/src/frontend/components/_organisms/variables-editor/index.tsx b/src/frontend/components/_organisms/variables-editor/index.tsx
index e3b650e59..d4e7858a3 100644
--- a/src/frontend/components/_organisms/variables-editor/index.tsx
+++ b/src/frontend/components/_organisms/variables-editor/index.tsx
@@ -1052,17 +1052,17 @@ const VariablesEditor = ({ name: propName, isActive: _isActive = true }: Variabl
{editorVariables.display === 'table' && (
- {editor.type === 'plc-textual' && editor.meta.pouType === 'function' && (
+ {(editor.type === 'plc-textual' || editor.type === 'plc-graphical') && editor.meta.pouType === 'function' && (