Repository navigation
Fix: Allow users to opt out of shiny's download autoenable - #4371
Merged
Merged
Conversation
cpsievert
reviewed
Apr 10, 2026
elnelson575
force-pushed
the
fix/autoenable-behavior
branch
from
April 23, 2026 23:21
f348912 to
35f71c4
Compare
cpsievert
reviewed
Apr 23, 2026
cpsievert
reviewed
Apr 23, 2026
cpsievert
reviewed
Apr 23, 2026
cpsievert
reviewed
Apr 23, 2026
cpsievert
reviewed
Apr 23, 2026
cpsievert
reviewed
Apr 23, 2026
schloerke
reviewed
Apr 24, 2026
schloerke
reviewed
Apr 24, 2026
schloerke
reviewed
Apr 24, 2026
schloerke
reviewed
Apr 24, 2026
elnelson575
force-pushed
the
fix/autoenable-behavior
branch
from
April 24, 2026 16:11
2e1c842 to
c16218b
Compare
elnelson575
commented
Apr 28, 2026
elnelson575
commented
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 28, 2026
cpsievert
reviewed
Apr 29, 2026
cpsievert
reviewed
Apr 29, 2026
cpsievert
reviewed
Apr 29, 2026
- Prevent early clicks on enabled=TRUE buttons before renderValue sets
the URL (href="" would otherwise navigate to the current page)
- Add skip_if_not_installed("shinyjs") to skip_if_not_shinytest2() so
tests skip cleanly in envs where shinyjs is not available
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
elnelson575
force-pushed
the
fix/autoenable-behavior
branch
from
May 7, 2026 19:57
afbab40 to
d3696b2
Compare
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Collaborator
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: cpsievert <[email protected]>
|
E Nelson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Contributor
Resolved and pushed in 4c0548e. I merged |
Collaborator
|
Thanks @elnelson575. Please also make a |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Move shinytest2 to Suggests; access shinyjs indirectly via getFromNamespace() to avoid the static pattern scanner.
Merged
4 tasks done
16 tasks done
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In v1.9.0 (#4041), Shiny began automatically enabling
downloadButton()/downloadLink()once the server'sdownloadHandleris ready. This is a good default — it prevents users from clicking a download button before the server can handle it.However, this auto-enable creates a problem for apps that want to keep a download button disabled until some condition is met (e.g., the user selects a dataset first). Before #4041, apps could render the button as disabled and use
shinyjs::enable()/shinyjs::disable()(or custom JS) to manage its state. Now, the auto-enable unconditionally overrides that disabled state as soon as thedownloadHandlerinitializes.Closes #4119. Also likely fixes daattali/shinyjs#277.
Solution
Add an
enabledparameter todownloadButton()anddownloadLink()with three possible values:"auto"(default): Current behavior — starts disabled, auto-enables when thedownloadHandleris ready. No breaking change.TRUE: Starts enabled immediately, without waiting for the server. Useful when you know the handler will be ready and don't want the brief disabled flash.FALSE: Starts disabled and Shiny will never auto-enable it. You manage the enabled/disabled state yourself (e.g., viashinyjs).Additionally, when
enabled = "auto", Shiny now detects ifshinyjshas independently disabled the element (via theshinyjs-disabledclass) and skips the auto-enable in that case. This meansshinyjs::disabled()in the UI andshinyjs::disable()from the server both work correctly without any explicit opt-out.Implementation details
data-shiny-disable-auto-enableattribute is added to the element whenenabledisTRUEorFALSE(i.e., any non-"auto"value). The client-siderenderValuechecks for this attribute (and forshinyjs-disabled) before enabling.pointer-events: none(previously, a disabled-looking anchor link could still be clicked).Also used by rstudio/bslib#1298.
App example
Screen.Recording.2026-04-23.at.6.33.35.PM.mov
Sample demo app