Copy Plot at Custom Size does not copy in Firefox when the console is busy
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, typescript
Research direction
Start by tracing the Copy Plot at Custom Size dialog and clipboard service; the issue does not name their files. Read the existing image clipboard write path and reproduce the steps in Firefox with the R console busy. Done when the copied plot is on the clipboard after the console becomes idle, including the delayed draw described here.
Written by the indexing model from the issue text.
Description
System details:
Positron and OS details:
Positron Web built from source on #17554, macOS, Firefox 155.0.1.
Session details:
R
Describe the issue:
In Positron Web on Firefox, Copy Plot at Custom Size does not copy the plot if the console is busy when you click Copy.
The dialog draws the plot before it writes it to the clipboard. If the console is busy, the draw waits until the console is idle. Firefox lets a page write to the clipboard only for a few seconds after a click, so the late write is blocked. Chrome does not have this limit. I did not test Safari, which has a stricter limit.
With #17554, the dialog shows an error in this case instead of "Plot copied to clipboard."
Steps to reproduce the issue:
- Open Positron Web in Firefox and start an R console.
- Run
plot(1:10). - In the Plots pane, open the Copy menu and select "Copy Plot at Custom Size...".
- Run
Sys.sleep(12)in the console. - While the console is busy, click Copy in the dialog.
Expected or desired behavior:
The plot is on the clipboard after the console is idle.
I see two possible fixes:
- Start the clipboard write when the user clicks Copy, with an image that is not ready yet (a
ClipboardItemwith aPromise<Blob>). The write then belongs to the click. It needs a new clipboard service method, becausewriteImagetakes only finished image data. Before I build it, I must make sure that Firefox accepts a promise that resolves many seconds later. - If the write is blocked, keep the drawn image and keep the dialog open, with a note that tells the user to click Copy again. The second click writes the image immediately. This works in all browsers but needs two clicks.
Were there any error messages in the UI, Output panel, or Developer Tools console?
"Error copying plot: Clipboard write was blocked due to lack of user activation." The write starts about 11 seconds after the click and fails with NotAllowedError.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 207
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 308
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/positron
-
area: assistant area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
accessibility area: plots area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: plots area: ui bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: kernels lang: r
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
posit-dev/positron#17575 · 2 comments ·
Maintainers usually reply within 1 day
-
Memory meter counts page cache as used memory under a cgroup limitPossibly taken @jmcphers claimed this 10 days ago. Openarea: workbench bug memory-use support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
posit-dev/positron#17414 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
All issues in posit-dev/positron
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Vessel9817/onion-site-template#512 ·
Maintainers usually reply within 1 day
-
nightly-tests
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Maintainers usually reply within 1 day
-
approved
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
fritzprix/libr-agent#3266 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
better-auth/better-auth#13101 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day