Plots: Allow panning a zoomed plot with the keyboard

Open Beginner friendly
#17,600 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
react, typescript

Research direction

Start with panZoomImage.tsx and plotsContainer.tsx, especially the plot-scroller focus behavior and the container’s keydown handler. Reproduce with plot(1:10) in the Plots pane at 200% zoom, then check the existing tests for these components. Done means arrow keys pan a focused zoomed plot and no longer switch plots in that case.

Written by the indexing model from the issue text.

Description

accessibility area: plots area: ui

A plot zoomed past Fit can be panned only with the mouse, by dragging or with the scrollbars. There is no way to pan it with the keyboard.

Steps to reproduce

  1. Run plot(1:10) in an R console.
  2. In the Plots pane, set the zoom to 200%.
  3. Click the plot, then press the arrow keys.

Expected: the arrow keys pan the zoomed plot.

Actual: Right and Down switch to the next plot. Left and Up switch to the previous plot. The zoomed plot stays scrolled to the top left.

Cause

  • The plot's scroll area (plot-scroller in panZoomImage.tsx) has no tabIndex, so it never takes keyboard focus.
  • Clicking the plot focuses .plots-container. Its keydown handler in plotsContainer.tsx turns every arrow key into previous or next plot.
Dominant language
TypeScript
Stars
4.4k
Forks
207
Avg merge
1d 16h
Merged PRs (30d)
308

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from posit-dev/positron

All issues in posit-dev/positron

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.