Copy Plot at Custom Size does not copy in Firefox when the console is busy

Abierto
#17,569 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
javascript, typescript
Área
desktop, frontend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area: plots bug

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:

  1. Open Positron Web in Firefox and start an R console.
  2. Run plot(1:10).
  3. In the Plots pane, open the Copy menu and select "Copy Plot at Custom Size...".
  4. Run Sys.sleep(12) in the console.
  5. 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:

  1. Start the clipboard write when the user clicks Copy, with an image that is not ready yet (a ClipboardItem with a Promise<Blob>). The write then belongs to the click. It needs a new clipboard service method, because writeImage takes only finished image data. Before I build it, I must make sure that Firefox accepts a promise that resolves many seconds later.
  2. 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.

Lenguaje dominante
TypeScript
Estrellas
4.4k
Forks
207
Merge medio
1 d 16 h
PR fusionados (30 d)
308

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de posit-dev/positron

Todos los issues de posit-dev/positron

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.