From b18016e43ef924a5e7fe61e4ac34b278a335c2de Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 26 Feb 2026 09:53:04 +1100 Subject: [PATCH] [UI] Disable copy button if not secure (#11427) - Hide copy button if not within secure context - Ref: https://github.com/inventree/InvenTree/discussions/11422 --- src/frontend/src/components/buttons/CopyButton.tsx | 5 +++++ src/frontend/src/forms/CompanyForms.tsx | 1 + src/frontend/src/tables/CopyableCell.tsx | 2 +- src/frontend/src/tables/InvenTreeTable.tsx | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/buttons/CopyButton.tsx b/src/frontend/src/components/buttons/CopyButton.tsx index 363487be5c..a43b4b3099 100644 --- a/src/frontend/src/components/buttons/CopyButton.tsx +++ b/src/frontend/src/components/buttons/CopyButton.tsx @@ -38,6 +38,11 @@ export function CopyButton({ }>) { const ButtonComponent = label ? Button : ActionIcon; + // Disable the copy button if we are not in a secure context, as the Clipboard API is not available + if (!window.isSecureContext) { + return null; + } + return ( {({ copied, copy }) => ( diff --git a/src/frontend/src/forms/CompanyForms.tsx b/src/frontend/src/forms/CompanyForms.tsx index de136355a4..e94bfedded 100644 --- a/src/frontend/src/forms/CompanyForms.tsx +++ b/src/frontend/src/forms/CompanyForms.tsx @@ -39,6 +39,7 @@ export function useSupplierPartFields({ }, manufacturer_part: { value: manufacturerPartId, + autoFill: true, filters: { manufacturer: manufacturerId, part_detail: true, diff --git a/src/frontend/src/tables/CopyableCell.tsx b/src/frontend/src/tables/CopyableCell.tsx index e07dec3b96..e90d122296 100644 --- a/src/frontend/src/tables/CopyableCell.tsx +++ b/src/frontend/src/tables/CopyableCell.tsx @@ -29,7 +29,7 @@ export function CopyableCell({ align='center' > {children} - {isHovered && value != null && ( + {window.isSecureContext && isHovered && value != null && ( e.stopPropagation()} diff --git a/src/frontend/src/tables/InvenTreeTable.tsx b/src/frontend/src/tables/InvenTreeTable.tsx index 250683db76..65cff57c19 100644 --- a/src/frontend/src/tables/InvenTreeTable.tsx +++ b/src/frontend/src/tables/InvenTreeTable.tsx @@ -285,8 +285,10 @@ export function InvenTreeTable>({ } const copyValue = rawCopyValue == null ? '' : String(rawCopyValue); - if (!!copyValue) { + if (window.isSecureContext && !!copyValue) { return {content}; + } else { + return content; } }; }