Modal dialogs: pressing Enter on a focused drop-down clicks the default button instead of opening the list
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
- typescript
- Domain
- accessibility, desktop
Research direction
Start with src/vs/workbench/browser/positronComponents/positronModalDialog/useModalDialogKeyboard.tsx and trace how the capture-phase Enter handler interacts with the focused DropDownListBox button. Check the modal keyboard tests and the Save Plot Format control to confirm expected behavior. Done means Enter opens the focused drop-down while Enter on the dialog body still invokes its default action.
Written by the indexing model from the issue text.
Description
In a Positron modal dialog, pressing Enter while a drop-down has focus runs the dialog's default action (and closes the dialog) instead of opening the drop-down. Space opens it as expected.
In the Save Plot dialog, this means a keyboard user who tabs to Format and presses Enter to pick a format saves the plot to disk at whatever settings were showing.
Steps to reproduce
- Make a plot, e.g.
plot(1:10)in R. - Click Save Plot in the Plots pane toolbar.
- Press Tab until the Format drop-down has focus.
- Press Enter.
Expected: the Format list opens, like it does with Space (and like a native <select> or upstream's select box).
Actual: the dialog closes and the plot is saved.
Cause
useModalDialogKeyboard (src/vs/workbench/browser/positronComponents/positronModalDialog/useModalDialogKeyboard.tsx) handles Enter for dialogs without a <form>: it clicks the first button.default unless the focused element is a textarea or a quick pick. The listener runs in the capture phase on the window (positronModalReactRenderer.tsx), so it consumes Enter before the focused DropDownListBox button sees it.
The same check probably catches any other focused button in these dialogs (for example Cancel or Browse), so Enter on them may also run the default action; this hasn't been verified.
Possible fix
Leave Enter to the focused element when it is itself a button (or a control that handles Enter, such as a drop-down), and only click the default button when focus is on a text input or the dialog body. The longer-term path the code comment describes, moving these dialogs to a <form> with enterHandledByCaller, would also fix it.
Accessibility
Keyboard users expect Enter to activate the focused button (WCAG 2.1.1 Keyboard; APG button pattern). Here it triggers an unrelated, irreversible action: writing a file.
Notes
- Present on main in the Save Plot dialog's Format drop-down. #2875 adds a second drop-down (Size, for PDF) that behaves the same.
- Found during exploratory testing of #2875.
- Related but different: #16339 (Enter doing nothing in the dynamic dialog).
- 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: 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
-
area: remote host bug support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
posit-dev/positron#17249 · 1 comment ·
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