react-component / react-component/trigger
Click-away (close on outside click) does not work in ShadowDom for action "click"
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- TypeScript
- Estrellas
- 391
- Forks
- 245
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
When using the popover from Antd in a WebComponent with the "click" action the "click away" does not work, the popover is never closed. When clicking on the trigger button the popover is closed.
<Popover content={<div>demo</div>} title="Title" trigger="click">
<Button>Click me</Button>
</Popover>
Expected:
Clicking on anything other than the popover content or the trigger (button in this case) the popover should close.
Actuall:
The popover is not closed.
Findings:
When using a popover from Antd inside a ShadoDom and using the trigger "click" the inPopupOrChild incorrectly thinks the mousedown/click is inside the content. There is something wrong in the checking of inPopupOrChild. The event retargeting makes the event come from the webcomponent and somehow the trigger thinks this is inside the content.
Workaround:
Catch the onMouseDown event in the webcomponent ctor and stop the bubbling with stopPropagation stops the event from reaching the global listener a second time.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza con la lógica inPopupOrChild del paquete trigger y reproduce el comportamiento usando el CodeSandbox enlazado dentro de un Shadow DOM. Rastrea cómo se retargetean los eventos mousedown y click y, a continuación, verifica que hacer clic fuera del popover lo cierre, mientras que hacer clic en el trigger o en el contenido del popover no lo haga.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- react, typescript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100