I3eka opened a new pull request, #44491:
URL: https://github.com/apache/superset/pull/44491

   ### SUMMARY
   
   Use Superset's existing `copyTextToClipboard` helper for the Native AI 
chat's shared copy callback instead of calling `navigator.clipboard.writeText` 
directly. This covers both whole-answer and fenced-code copy buttons, including 
code shown in the thought/tool log.
   
   On a non-loopback HTTP origin, `navigator.clipboard` is unavailable. The 
direct call throws and the chat reports "Sorry, your browser does not support 
copying." Other Superset copy buttons already handle this through the shared 
helper's compatibility fallback. This change reuses that helper; it adds no 
dependency, browser permission, insecure-origin exception, or custom clipboard 
implementation. A genuine failure still shows the error toast.
   
   **Draft follow-up to #42805.** The focused change is [commit 
c4cc930151](https://github.com/I3eka/superset/commit/c4cc9301512bd91518c6159899ee375574884162),
 three files relative to `0e4a15cca1c5be2b7e68d609a9062f5e51193024`: the 
callback, regression tests and documentation. Native AI is not in Apache 
master, so the overall PR comparison necessarily includes that prerequisite. 
This should not be merged before the parent/SIP decision; unrelated feedback, 
Unicode and docking fixes are not included in this commit. @sadpandajoe, this 
is a small compatibility fix for the shared Native AI copy path.
   
   Searched open Apache issues/PRs for clipboard/copying/AI-copy reports before 
implementing; no matching fix was found.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: reproduced the exact failure in Chromium on an HTTP non-loopback 
test deployment; `window.isSecureContext` is false and `navigator.clipboard` is 
absent. No clipboard permission or security override was applied. Private 
conversation content is not included in screenshots.
   
   After: the shared helper attempts the existing DOM-selection copy fallback, 
preserving Cyrillic and line breaks. Actual deployment/browser validation is 
being recorded separately; the passing unit tests below are not a claim of 
upstream CI or live clipboard success.
   
   ### TESTING INSTRUCTIONS
   
   - New keyboard-accessible copy-button regression covers Clipboard API 
success, API absence, API rejection with successful fallback, and failure of 
both methods. It checks the exact multiline Cyrillic text selected for copying, 
selection cleanup, and the appropriate success/error toast. The real shared 
helper is used, not mocked.
   - On the unchanged parent, the new absent/rejected API cases fail because no 
success toast is emitted; the both-methods-fail case also proves the fallback 
was never attempted. With the fix, all four cases pass.
   - Parent-based targeted chat-markdown, CopyToClipboard and core clipboard 
suites: **37 tests pass across three suites**, using the existing local 
Jest/ts-jest compatibility harness for this older base.
   - Formatting, frontend lint, custom rules and stylelint pass on the changed 
files. Parent-based targeted TypeScript checking is **not green** in the 
current workspace: it reports the same five pre-existing errors in the 
virtualized datasource tree, `exploreUtils`, and `ThemeProvider` reproduced on 
the parent. None are in this patch.
   - `pre-commit run --all-files` was also attempted in an isolated checkout as 
required by the parent instructions. It is **not green**: unrelated 
formatting/lint failures and environment/dependency issues (including missing 
docs Yarn, Helm tooling and generated declarations) remain. Its unrelated 
auto-fixes are not included here.
   - On the current deployment integration, **184 tests pass across 16 
suites**, all applicable changed-file checks including TypeScript pass, and the 
production frontend build succeeds with four existing bundle/performance 
warnings.
   
   Manual check: open an existing AI answer on an HTTP non-loopback origin, 
click its copy button, then paste into an unsent draft or local editor. Verify 
the complete answer, including Unicode/newlines. Repeat for a code block. With 
clipboard methods blocked, verify that the error is still shown instead of a 
false success.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Native AI prerequisite #42805; user-reported 
HTTP clipboard failure reproduced locally
   - [x] Required feature flags: `AI_ASSISTANT`, `ENABLE_EXTENSIONS`
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in SIP-59)
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to