SuperChat Mention List Stays Open After the Composer Loses Focus

オープン 初心者向け
#795 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend, testing

調査の方向性

src/components/Messaging/useMentionAutocomplete.tsx と ChatComposer の textarea ハンドラーから始め、hook が portal に描画されたメンションメニューをどのように開閉するかを追ってください。composer のテストを見つけ、blur でリストが閉じること、未完了の @query に対して focus で再び開くこと、マウスで選択するとメンションが挿入されることをテストしてください。これらのケースが通り、メディアビューアーを開いたときにメンションリストが表示されたままにならなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Overview

The @mention suggestion list in ChatComposer, which SuperChat and SuperChatInbox use, stays open after focus leaves the composer. Because the menu is portaled to document.body, it stays on screen over whatever comes next: a media viewer opened from the thread, or a different page in a host app that keeps the inbox mounted while it is hidden. The only way to dismiss it is to go back to the composer and press Escape or delete the @.

ECG rhythm strip Pasted Graphic 1 000000

Steps to Reproduce

In Storybook: SuperChat › Inbox › Playground

  1. Type @ in the composer. The participant list opens.
  2. Without choosing anyone, click an image in the thread to open the media viewer.
  3. The mention list stays open on top of the viewer.

In a host app that keeps the inbox mounted: TimeHuddle wraps its inbox page in React <Activity mode="hidden"> when another tab is showing.

  1. Type @ in the composer.
  2. Switch to another tab or page.
  3. The mention list is still on screen over the other page.

Current State

  • useMentionAutocomplete (src/components/Messaging/useMentionAutocomplete.tsx) closes the menu only on Escape, when an option is inserted, or when an edit removes the @ query.
  • Nothing closes it on textarea blur or on a pointer down outside the menu.
  • MentionMenu renders through createPortal(..., document.body). Hiding or covering the composer's subtree does not hide the menu. React <Activity mode="hidden">, for example, does not hide portaled content.

Proposed Changes

  1. Close the menu when the textarea blurs
    • Clear the active mention in the composer textarea's onBlur, for example through a close() that the hook returns.
    • Options already use onMouseDown with preventDefault(), so clicking an option keeps focus and still inserts it.
    • The textarea's onFocus or onSelect can call sync() again, so returning to an unfinished @query reopens the list.
  2. Test
    • Type @, blur the textarea, and expect chat-composer-mention-list to be gone.
    • Refocus with the caret after the @, and expect the list to reopen.
    • Clicking an option still inserts it.

Acceptance Criteria

  • The mention list closes when the composer textarea loses focus.
  • Choosing an option with the mouse still inserts the mention.
  • Focusing the composer again with an unfinished @query reopens the list.
  • In Storybook, opening the media viewer while the list is open leaves no list on screen.
  • A unit test covers closing on blur and reopening on focus.

Out of Scope (for Now)

  • Shared listbox keyboard navigation (#376).
  • Closing other portaled composer menus (the + add menu, send options), which already close on outside click through Dropdown.
  • Changing how a host hides the inbox.
主要言語
TypeScript
スター
2
フォーク
7
平均マージ
1日 12時間
マージ済み PR(30日)
62

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mieweb/ui のほかの issue

mieweb/ui の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。