# Feature OP-20331 - Clear work package selection with Escape instead of Ctrl/Cmd+D

Project: OpenProject
Status: in test
URL: https://community.openproject.org/work_packages/OP-20331

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 18.0.0 |
| Sprint |  |
| Backlog bucket |  |
| Votes |  |
| List | a11y report 2026 |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Frontend components and Primer design system, Modules and project features / Work packages |
| Feature Flag |  |
| Requires doc change | Yes |
| Enterprise plan | Community (COM) |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | Yes |

## People

| Attribute | Value |
| --- | --- |
| Assignee | Ivana Šugić |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers | Alexander Coles |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

## Context

Follow-up from <mention class="mention" data-id="OP-20383" data-type="work_package" data-text="#OP-20383">#OP-20383</mention> (<https://github.com/opf/openproject/pull/25284>) and <mention class="mention" data-id="OP-20384" data-type="work_package" data-text="#OP-20384">#OP-20384</mention> (<https://github.com/opf/openproject/pull/25614>). Table and card views cleared their selection with a Mousetrap **Ctrl/Cmd+D** binding in `WorkPackageViewSelectionService`. Sortable Lists / Backlogs (<mention class="mention" data-id="AGILE-181" data-type="work_package" data-text="#AGILE-181">#AGILE-181</mention>) clear with **Escape** from anywhere in the document unless an overlay, menu or editable control owns the key. The two should match.

The **Ctrl/Cmd+D** binding had three defects of its own: it prevented the browser's bookmark shortcut wherever a table or card view had registered it, `Mousetrap.bind` replaces so only the last registered view (embedded or main table) reset, and service teardown unbound it globally so destroying one view disabled the shortcut for surviving views.

## Goal

**Escape** clears membership, anchor and range state in every table or card view on the page when no higher-priority UI owns the key. **Ctrl/Cmd+D** no longer clears selection.

## Acceptance criteria (manual QA)

Setup: a project with at least five work packages, some with start and finish dates. Open the work package table and select two or three rows (click, **Ctrl/Cmd**-click or **Shift**-click). Selected rows are highlighted. Repeat the table checks in the card view where marked.

### Escape clears the selection

1.  Select rows, click an empty area of the page, press **Escape**. All rows are deselected.
2.  Select rows, keep focus on a selected row, press **Escape**. All rows are deselected.
3.  Card view: select cards, press **Escape**. All cards are deselected.
4.  My page or a project overview with two work package table widgets: select rows in both, press **Escape** once. Both widgets are deselected.
5.  Open the split view (details pane) for a selected row, click a non-editable area in the pane (e.g. a tab), press **Escape**. The list selection clears; the pane stays open.
6.  **Ctrl/Cmd**-click the only selected row so nothing is selected, press **Escape**, then **Shift**-click another row. Only the clicked row is selected; the range does not start from the previously deselected row.
7.  With nothing selected, press **Escape**. Nothing happens.

### Escape keeps its existing job first (one press = one action)

Select rows first. In each case the first **Escape** must only close or cancel the named thing and leave the rows selected. Once that thing is closed or cancelled, and with focus no longer inside a text field, the next **Escape** clears the selection.

1.  Right-click a row to open the context menu. **Escape** closes the menu.
2.  Open a dialog (e.g. the table configuration or Share dialog). **Escape** closes the dialog.
3.  In the split view, open a date field's date picker. **Escape** closes the picker.
4.  Inline edit a table cell (e.g. Subject). **Escape** cancels the edit.
5.  Click "Create new work package" under the table. **Escape** removes the new row. A second **Escape**, with focus back on the "Create new work package" button, clears the selection.
6.  Focus a filter or autocomplete input. **Escape** is handled by the field and does not clear the selection for as long as focus stays in the field.
7.  Gantt: start dragging a bar (or drag across an empty cell to set dates) and press **Escape** before releasing the mouse. The drag is cancelled and dates are unchanged.
8.  Gantt: select exactly one row (relation actions are not offered for a multi-selection), right-click it and choose "Add predecessor" or "Add successor" ("Click on any highlighted work package…" notice appears). **Escape** leaves that mode and the row stays selected.
9.  My page or project overview in edit mode: start dragging or resizing a widget, press **Escape**. The drag or resize is cancelled; the table widget's selection stays.

### Ctrl/Cmd+D is no longer intercepted

1.  With rows selected, press **Ctrl+D** (Windows/Linux) or **Cmd+D** (macOS). The browser's bookmark dialog opens and the selection is unchanged.

### Browsers

Check in Chrome, Firefox and Safari.

## Release note

"Press **Escape** to clear work package selections in tables and cards, matching Sortable Lists. **Ctrl/Cmd+D** no longer clears selection."

## Notes

  - Implementation: <https://github.com/opf/openproject/pull/25616>, stacked on <https://github.com/opf/openproject/pull/25614> and <https://github.com/opf/openproject/pull/25284>.
  - The keyboard shortcuts user guide gains a "Clear a work package selection" section.
  - Out of scope: screen-reader announcement when the selection clears (<mention class="mention" data-id="DREAM-846" data-type="work_package" data-text="#DREAM-846">#DREAM-846</mention>); **Ctrl/Cmd+Shift+A** compatibility (<mention class="mention" data-id="DREAM-936" data-type="work_package" data-text="#DREAM-936">#DREAM-936</mention>).
