SuperChat Mention List Stays Open After the Composer Loses Focus

Abierto Apto para principiantes
#795 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
react, typescript
Área
frontend, testing

Línea de trabajo

Empieza por src/components/Messaging/useMentionAutocomplete.tsx y los manejadores del textarea de ChatComposer; sigue cómo el hook abre y cierra el menú de menciones renderizado en un portal. Busca las pruebas del composer y cubre el cierre de la lista al perder el foco, su reapertura al recuperar el foco para una @query sin terminar y la inserción de la mención al seleccionarla con el ratón. El trabajo está terminado cuando esos casos pasan y al abrir el visor de medios no queda visible ninguna lista de menciones.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
2
Forks
7
Merge medio
1 d 12 h
PR fusionados (30 d)
62

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de mieweb/ui

Todos los issues de mieweb/ui

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.