{"record":{"id":"2a77b1eb8efc186e","repo":"zed-industries/zed","slug":"failed-to-set-canvas-property-style-error","errorCode":null,"errorMessage":"Failed to set canvas {property} style: {error:?}","messagePattern":"Failed to set canvas (.+?) style: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/window.rs","lineNumber":132,"sourceCode":"            .create_element(\"canvas\")\n            .map_err(|error| anyhow::anyhow!(\"Failed to create canvas element: {error:?}\"))?\n            .dyn_into()\n            .map_err(|error| anyhow::anyhow!(\"Created element is not a canvas: {error:?}\"))?;\n        canvas.set_tab_index(-1);\n\n        let style = canvas.style();\n        for (property, value) in [\n            (\"width\", \"100%\"),\n            (\"height\", \"100%\"),\n            (\"display\", \"block\"),\n            (\"outline\", \"none\"),\n            (\"touch-action\", \"none\"),\n            (\"-webkit-touch-callout\", \"none\"),\n            (\"user-select\", \"none\"),\n            (\"-webkit-user-select\", \"none\"),\n        ] {\n            style.set_property(property, value).map_err(|error| {\n                anyhow::anyhow!(\"Failed to set canvas {property} style: {error:?}\")\n            })?;\n        }\n\n        let body = document\n            .body()\n            .ok_or_else(|| anyhow::anyhow!(\"No `body` found on document\"))?;\n        body.append_child(&canvas)\n            .map_err(|error| anyhow::anyhow!(\"Failed to append canvas to body: {error:?}\"))?;\n        Ok(canvas)\n    }\n\n    #[allow(clippy::too_many_arguments)]\n    pub(crate) fn new(\n        _handle: AnyWindowHandle,\n        _params: WindowParams,\n        context: &WgpuContext,\n        canvas: web_sys::HtmlCanvasElement,\n        surface: wgpu::Surface<'static>,","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/gpui_web/src/window.rs#L114-L150","documentation":"Guard in WebWindow::prepare_canvas: CSSStyleDeclaration.setProperty threw while applying the fullscreen sizing styles (width/height/display/outline/touch-action) to the canvas — {property} names the style that failed, {error:?} the JS exception.","triggerScenarios":"Thrown at crates/gpui_web/src/window.rs:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log which property failed — usually a CSP style-src restriction or an unusual CSSOM","Ensure the embedding page's CSP allows inline style manipulation","Fall back to setting style attributes directly (setAttribute) if setProperty is blocked"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}