Fix quote reply shortcut in work item side panel

What does this MR do and why?

Fixes the quote reply shortcut in the work item side panel.

With text selected in the side panel (split view, opened from the work item list, planning view, or related items), pressing r focused the reply box but did not quote the selected text. It worked on the full work item page.

CopyAsGFM.selectionToGfm() only accepts selections inside #content-body by default. The side panel is rendered into #contextual-panel-portal, outside #content-body, so the selection was discarded and nothing was quoted.

When the notes are rendered in the panel (isDrawer), this MR passes the panel element (.work-item-detail-panel) as the root. The full page is unchanged.

A Jest spec asserts that the panel element is passed as the root. It fails without the fix. The full work_item_notes_spec.js passes (54 tests).

References

  • #574899 (closed) "Work item shortcuts are not performed on the side panel" (closed). This MR is a follow-up to it. Its fix, !208057 (merged), made other shortcuts act on the panel item but did not change how the selected text is captured.
  • #523101 (closed) "Support "r" and "up" shortcuts in work item comments" (closed; related).
  • No existing issue was found for this specific bug.

Screenshots or screen recordings

Not applicable. This change affects behavior only, with no visual change.

How to set up and validate locally

  1. Open a work item's side panel from the work item list.
  2. Select text in a comment or the description.
  3. Press r.
  4. Confirm the reply box contains the selected text as a Markdown blockquote.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading