aboutsummaryrefslogtreecommitdiff
path: root/docs/prototypes
diff options
context:
space:
mode:
Diffstat (limited to 'docs/prototypes')
-rw-r--r--docs/prototypes/panel-widget-gallery.html34
1 files changed, 15 insertions, 19 deletions
diff --git a/docs/prototypes/panel-widget-gallery.html b/docs/prototypes/panel-widget-gallery.html
index e64ddd3..007b4cd 100644
--- a/docs/prototypes/panel-widget-gallery.html
+++ b/docs/prototypes/panel-widget-gallery.html
@@ -1079,34 +1079,30 @@ function GVexport(){
if(v!=='off') rows.push(' "'+l.closest('.card').id.slice(5)+'": "'+v+'"');});
return '{\n'+rows.join(',\n')+'\n}';
}
-/* Surface the export as a selected textarea. This deliberately does NOT try to
- reach the clipboard, because on this setup (Chrome 150, native Wayland, no
- clipboard manager) neither clipboard path works from a file:// page:
+/* Hand the export over selected, and let the reader press Ctrl+C themselves.
+ The page deliberately never tries to copy on their behalf, because from a
+ file:// origin neither programmatic path works here (Chrome 150, 2026-07-16):
- navigator.clipboard.writeText rejects NotAllowedError, "Write permission
denied" — a file origin can't hold the clipboard-write permission.
- - document.execCommand('copy') returns TRUE and writes an empty string. The
- clipboard ends up owned, advertising text/plain, serving nothing. Chrome
- sets the PRIMARY selection but not CLIPBOARD; a hand-typed Ctrl+C in the
- page behaves the same way, so it is not specific to execCommand.
- JS can't detect any of this — readText is denied too — so claiming "copied"
- would be a lie the code cannot check. Selecting the text is the one thing
- that reliably works: a selection IS the X/Wayland PRIMARY selection, readable
- with `wl-paste --primary`. Verified twice against the live browser.
- The blur teardown is safe: Chrome keeps serving PRIMARY after the textarea is
- gone (observed — the export read back fine both times, each after switching
- away from the browser, which is what fires the blur). So the selection does
- NOT have to stay on screen to survive; the handler only avoids leaving a
- textarea sitting on the page. What does clobber PRIMARY is selecting text
- anywhere else, which no handler here can prevent. */
+ - execCommand('copy') returns TRUE and writes nothing. Worse than failing,
+ because the return value invites the page to claim success it didn't have.
+ A hand-typed Ctrl+C works fine, so this is specific to a page copying on the
+ user's behalf, NOT a broken clipboard: a Wayland-set clipboard crosses to X11
+ and Emacs reads it correctly (sentinel-verified). Selecting the text is
+ therefore the whole job — the user's own copy is the one that works, and it
+ lands in the real clipboard where every app can reach it.
+ Do NOT "improve" this by reading the X/Wayland PRIMARY selection instead:
+ PRIMARY holds whatever was last selected ANYWHERE, so it silently returns
+ unrelated content (it produced a private SMS while this was being built). */
function gvCopy(btn){
- const flash=m=>{btn.textContent=m;setTimeout(()=>btn.textContent='copy for source',2200);};
+ const flash=m=>{btn.textContent=m;setTimeout(()=>btn.textContent='copy for source',2600);};
const ta=document.createElement('textarea');
ta.value=GVexport();
ta.style.cssText='position:fixed;left:12px;bottom:12px;z-index:70;width:320px;height:170px;'+
'font:12px ui-monospace,monospace;background:#14120f;color:#e8dcc0;border:1px solid #7d5c16;'+
'border-radius:4px;padding:6px';
document.body.appendChild(ta); ta.select();
- flash('selected ▸');
+ flash('press Ctrl+C ▸');
ta.addEventListener('blur',()=>ta.remove());
}
/* index tally: recounts every card lamp; setV calls it on every state change.