Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Overview

This PR enhances the keyboard accessibility of the download modal, allowing users to press Enter from any input field to trigger the download action. This improvement makes it significantly faster to download multiple reports consecutively, as requested in #[issue_number].

Problem

Previously, users had to:

  1. Fill in the download form fields (Author, Title, Date, etc.)
  2. Move focus away from the input fields
  3. Click the "Download" button with the mouse

This workflow was inefficient when downloading multiple reports one after another, as the cursor position was already in the form fields but pressing Enter had no effect.

Solution

Implemented a new JavaScript function enterToSubmitModal that:

  • Listens for Enter key events on all INPUT and SELECT elements within the modal
  • Automatically triggers the download action when Enter is pressed
  • Works from any input field in the form (Author, Title, Date, Document Type, Table of Contents checkbox, Include R Code checkbox)

This follows the same pattern already used in the add card modal (enterToSubmit), but extends it to work with all form inputs rather than a single specific field.

Changes

  • inst/js/extendShinyJs.js: Added new enterToSubmitModal function for modal-wide Enter key handling
  • R/download.R: Integrated the new function into the download modal
  • NEWS.md: Documented the enhancement

Testing

✅ JavaScript syntax validated with Node.js
✅ CodeQL security scan passed with no issues
✅ Follows existing code patterns and conventions

Benefits

  • Improved UX: Faster workflow when downloading multiple reports
  • Better accessibility: Enhanced keyboard navigation support
  • Non-breaking: Purely additive change that doesn't affect existing functionality
  • Consistent: Aligns with the keyboard behavior already present in other modals
Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature Request]: Download the reporter quicker with the keyboard</issue_title>
<issue_description>### Feature description

The modal to download the report could be more keyboard friendly. The cursor initial position is great, and tab works well to move between inputs but user cannot directly download the report just pressing enter wherever the cursor is.

I only suggest this after downloading multiple reports one after the other.

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #434


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Improve keyboard accessibility for report downloading Add keyboard support to download modal for faster report downloads Oct 24, 2025
Copilot AI requested a review from m7pr October 24, 2025 12:16
Copilot finished work on behalf of m7pr October 24, 2025 12:16
@m7pr m7pr marked this pull request as ready for review October 24, 2025 12:17
@github-actions
Copy link
Contributor

badge

Code Coverage Summary

Filename                      Stmts    Miss  Cover    Missing
--------------------------  -------  ------  -------  --------------------------------------------------
R/add_card.R                    130      10  92.31%   47-54, 143, 184
R/download.R                    191      22  88.48%   27-33, 87-93, 149, 195-196, 261-265
R/editor_block.R                 28      15  46.43%   81-96
R/editor_card.R                  43      15  65.12%   2-15, 24
R/LoadReporterModule.R          108      32  70.37%   20-26, 101-106, 109-114, 120-125, 137-143
R/previewer_card_actions.R      115      17  85.22%   80-83, 94, 105-113, 117-118, 123
R/previewer_card.R               39      24  38.46%   2-27
R/previewer_content.R            52      23  55.77%   5-19, 28-29, 31-32, 47, 59, 63, 67
R/previewer_deprecated.R         78      33  57.69%   38-71, 113
R/previewer_report.R             80      26  67.50%   20-32, 94-108
R/render.R                       32       0  100.00%
R/ReportCard.R                   63      13  79.37%   51, 130-131, 186-229, 247
R/Reporter.R                    175      21  88.00%   128, 156, 211, 319-328, 364-365, 370-375, 444, 494
R/ResetModule.R                  56       8  85.71%   20-27
R/SimpleReporter.R               30      15  50.00%   39-53
R/teal_card.R                   157       3  98.09%   428-430
R/teal_report-c.R                 5       0  100.00%
R/teal_report-class.R            26       2  92.31%   50, 131
R/teal_report-eval_code.R         6       1  83.33%   27
R/teal_report-extract.R           3       0  100.00%
R/to_rmd.R                       86      30  65.12%   13, 67, 82-97, 128-136, 161, 223-229
R/toHTML.R                       48       5  89.58%   158, 230-264
R/utils.R                        96      28  70.83%   25, 34, 127-152
R/yaml_utils.R                   81       2  97.53%   78, 287
R/zzz.R                          29       1  96.55%   29
TOTAL                          1757     346  80.31%

Diff against main

Filename        Stmts    Miss  Cover
------------  -------  ------  -------
R/download.R       +6       0  +0.37%
TOTAL              +6       0  +0.07%

Results for commit: 4cf549b

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

Unit Tests Summary

  1 files   25 suites   2m 0s ⏱️
235 tests 229 ✅ 6 💤 0 ❌
369 runs  363 ✅ 6 💤 0 ❌

Results for commit 4cf549b.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
Reporter 💔 $95.78$ $+1.86$ $0$ $0$ $0$ $0$

Results for commit 12edbf4

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Download the reporter quicker with the keyboard

2 participants