diff --git a/packages/react/src/components/CodeEditor/CodeEditor.jsx b/packages/react/src/components/CodeEditor/CodeEditor.jsx index 1d8738bdf5..1858c4b06b 100644 --- a/packages/react/src/components/CodeEditor/CodeEditor.jsx +++ b/packages/react/src/components/CodeEditor/CodeEditor.jsx @@ -82,14 +82,6 @@ const CodeEditor = ({ useEffect(() => { updateEditorAttribute(disabled, editorValue); - - const button = document.getElementsByClassName('iot--code-editor-copy')[0]; - - if (disabled) { - button.setAttribute('disabled', ''); - } else if (button?.hasAttribute('disabled')) { - button.removeAttribute('disabled'); - } }, [disabled]); /** @@ -181,7 +173,7 @@ const CodeEditor = ({ ( ); diff --git a/packages/react/src/components/CodeEditor/CodeEditor.test.jsx b/packages/react/src/components/CodeEditor/CodeEditor.test.jsx index 58d0826f86..5f8d1e9827 100644 --- a/packages/react/src/components/CodeEditor/CodeEditor.test.jsx +++ b/packages/react/src/components/CodeEditor/CodeEditor.test.jsx @@ -223,7 +223,7 @@ describe('CardEditor', () => { expect(uploadInputDisabled).toHaveAttribute('disabled'); const copyDisabled = container.querySelector(`.${iotPrefix}--code-editor-copy`); - expect(copyDisabled).toHaveAttribute('disabled'); + expect(copyDisabled).not.toHaveAttribute('disabled'); rerender(