Skip to content

Conversation

@martrapp
Copy link
Member

@martrapp martrapp commented May 5, 2025

Changes

When submitting a form, the client router now delegates back to the browser when the user holds hift alt or cmd/ctrl keys while clicking submit. This allows the browser to open a new tab / window or download. These are all cases where you won't get view transitions anyhow.

Closes #13744

Testing

tested manually

Docs

n.a., bug fix

@changeset-bot
Copy link

changeset-bot bot commented May 5, 2025

🦋 Changeset detected

Latest commit: e6d283a

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label May 5, 2025
@martrapp
Copy link
Member Author

martrapp commented May 5, 2025

The code already existed in the click handler, but could not be directly reused for form submission as the submit event is no mouse event and does not know about keys. But if the form get's submitted by clicking, we remember the last "clicked with keys" element and compare it to the submit's submitter element.

@martrapp martrapp requested a review from Copilot May 5, 2025 10:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request improves the ClientRouter behavior, allowing form submissions to trigger native browser handling (e.g., open new tabs or windows) when users hold modifier keys during a click.

  • Delegates form submissions to the browser when modifier keys (Cmd, Ctrl, or Shift) are detected
  • Documents the change via an updated changeset file
Files not reviewed (1)
  • packages/astro/components/ClientRouter.astro: Language not supported

@martrapp martrapp merged commit 7d3127d into main May 6, 2025
14 checks passed
@martrapp martrapp deleted the mt/open branch May 6, 2025 16:05
@astrobot-houston astrobot-houston mentioned this pull request May 6, 2025
openscript pushed a commit to openscript/astro that referenced this pull request Sep 12, 2025
…o#13750)

* ClientRouter: honor ctrl/shift... keys when clicking submit

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

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to submit forms in a new tab when using ClientRouter

2 participants