TJ 99c42af5fc fix(site/src): stop delete dialog keys and clicks from activating rows (#29868)
Fixes
[DASH-106](https://linear.app/codercom/issue/DASH-106/show-validation-error-for-incorrect-workspace-deletion-confirmation).

In the workspaces list, pressing Enter or Space in the delete
confirmation input took you to the workspace page. Nothing was deleted
and there was no explanation. Review turned up related problems in the
same dialog, which this PR also fixes.

**Root cause:** React sends events from portaled content (dialogs,
menus) up through the component tree to parent components. The delete
dialog is rendered inside a clickable workspace row. The row reacted to
Enter and Space from the dialog's input as if the row itself had been
activated, and it did the same for middle clicks. The actions cell
already stopped normal clicks from reaching the row, but not key events
or middle clicks.

**Changes**

- `useClickable` / `useClickableTableRow`:
  - Enter and Space only activate the row when the row itself has focus.
- Clicks, middle-clicks, and double-clicks from portaled content are
ignored (`isFromPortal`). A middle-click paste (Linux) into the dialog
no longer opens the workspace in a new tab.
- A nested native button still sends its own click to the row unless it
stops click propagation, as the existing row buttons already do.
- New `DeleteConfirmationField` + `useDeleteConfirmation`, shared by
`WorkspaceDeleteDialog` and `DeleteDialog`. They previously duplicated
this logic. The shared field provides:
- Enter with a wrong name shows the error immediately, instead of only
after the input loses focus. Screen readers announce it
(`role="alert"`).
- The typed text is quoted and keeps its whitespace, so a stray space is
visible.
- `WorkspaceDeleteDialog` clears the typed name, "Orphan Resources", and
the error whenever the dialog closes, including after confirm (the
parent closes it then). Before, typing the correct name, cancelling, and
reopening showed an enabled Delete button, so one click deleted the
workspace without retyping.
- `DeleteDialog` (shared) clears the typed name whenever its dialog
closes, including when the parent closes it, as the organization page
does after a failed delete. Before, reopening showed Delete already
enabled. Callers that keep the dialog open after a failed delete
(templates, users) still keep the typed name so the user can retry.
- `WorkspaceOutdatedTooltip`, `ProviderRow`, `ModelRow`: removed key
handlers that only worked around the old row behavior, and corrected
their comments.

**Decisions**

- The mismatch error appears below the input without a reserved slot, so
the controls below move down when it shows (unchanged from `main`, by
design decision).
- Enter with an empty input stays silent on purpose. It doesn't confirm
or navigate, and the disabled Delete button signals that a name is
needed.
- Workspace names can't contain spaces, so a typed space leads to the
mismatch error. The input doesn't block spaces.

**Verification**

- Unit tests:
- Enter and Space from inline and portaled inputs don't activate a
clickable element.
- Clicks and middle-clicks from portaled content don't activate the row.
- Enter with a wrong name marks the input invalid and announces the
error. Editing the name clears it.
  - A matching name confirms on Enter.
- The workspace dialog reopens empty after cancel and after confirm. The
shared dialog reopens empty after its parent closes it, and keeps the
typed name while it stays open for a retry.
  - Each new test fails when the code it covers is removed.
- Stories: new `FilledWrongSubmitted` (error shown while focused).
- Related unit tests and stories pass for every clickable table page and
every `DeleteDialog` caller (workspaces, templates, organizations,
users, Agents).
- Tested by hand by @tracyjohnsonux before the reset, shared-field, and
click-guard changes.

---

_Generated by Coder Agents on behalf of @tracyjohnsonux._
2026-09-25 14:50:24 -07:00
…
…
…

Coder Logo Light Coder Logo Dark

Self-Hosted Cloud Development Environments and AI Agents

Coder Banner Light Coder Banner Dark

Quickstart | Docs | Why Coder | Premium

discord release godoc OpenSSF Best Practices OpenSSF Scorecard license

Coder is a self-hosted platform for cloud development environments and AI coding agents. Workspaces are defined with Terraform, connected through a secure Wireguard® tunnel, and automatically shut down when not used. Coder Agents runs a native AI coding agent whose loop executes in the control plane on your infrastructure, with no API keys in workspaces.

  • Define cloud development environments in Terraform
    • EC2 VMs, Kubernetes Pods, Docker Containers, etc.
  • Automatically shutdown idle resources to save on costs
  • Onboard developers in seconds instead of days
  • Delegate coding work to AI agents on your infrastructure
    • Bring any model (Anthropic, OpenAI, Google, Bedrock, self-hosted)
    • No LLM credentials in workspaces, user identity on every action
    • Centralized model governance, cost tracking, and audit logging

Coder platform showing templates and a running workspace

Quickstart

Check out our install guides for other methods and a complete tutorial.

Try Coder with the install script on Linux and macOS, or grab the latest binary or installer from GitHub Releases on Windows:

curl -fsSL https://coder.com/install.sh | sh

Start the server and open http://localhost:3000 to create your initial user, create a Docker template, and provision your first workspace:

coder server

For a production deployment, add a PostgreSQL database (version 13 or later) and an external access URL, and see our validated architectures for sizing and infrastructure guidance:

coder server --postgres-url <url> --access-url <url>

Without these flags, Coder uses a built-in database and sets up a *.try.coder.app access URL for evaluation. Use coder --help for the full list of flags and environment variables.

Documentation

Browse the documentation or visit a specific section below:

  • Workspaces: Workspaces contain the IDEs, dependencies, and configuration information needed for software development
  • Templates: Templates are written in Terraform and describe the infrastructure for workspaces
  • Coder Agents: Delegate coding work to AI agents running on your self-hosted infrastructure
  • AI Gateway: Centralize authentication, auditing, and cost controls for AI tooling
  • Administration: Learn how to operate Coder
  • Premium: Learn about paid features built for large teams
  • IDEs: Connect your existing editor to a workspace

Support

Open an issue for bugs and feature requests.

For community support, showcasing what you built, and feedback on in-progress features, join our Discord or GitHub Discussions.

Dedicated support is included in Coder Premium. For more information, visit coder.com/pricing.

Integrations

New integrations are always in progress. Open an issue to request one. Contributions are welcome in any official or community repository.

Official

Community

Contributing

New contributors are always welcome. If you are new to the Coder codebase, see the contribution guide to get started.

Hiring

Apply on the careers page if you are interested in joining the team.

S
Description
Provision remote development environments via Terraform
Readme AGPL-3.0
1,022 MiB
Languages
Go 74.9%
TypeScript 23.1%
Shell 0.8%
HCL 0.3%
PLpgSQL 0.3%
Other 0.4%