File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
static/app/views/explore/logs Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1+ import type { SyntheticEvent } from 'react' ;
12import { Fragment , useCallback , useState } from 'react' ;
23import { useTheme } from '@emotion/react' ;
34
@@ -62,6 +63,21 @@ type LogsRowProps = {
6263
6364const ALLOWED_CELL_ACTIONS : Actions [ ] = [ Actions . ADD , Actions . EXCLUDE ] ;
6465
66+ function isInsideButton ( element : Element | null ) : boolean {
67+ let i = 10 ;
68+ while ( element && i > 0 ) {
69+ i -= 1 ;
70+ if (
71+ element instanceof HTMLButtonElement ||
72+ element . getAttribute ( 'role' ) === 'button'
73+ ) {
74+ return true ;
75+ }
76+ element = element . parentElement ;
77+ }
78+ return false ;
79+ }
80+
6581export function LogRowContent ( {
6682 dataRow,
6783 highlightTerms,
@@ -74,7 +90,11 @@ export function LogRowContent({
7490 const search = useLogsSearch ( ) ;
7591 const setLogsSearch = useSetLogsSearch ( ) ;
7692
77- function onPointerUp ( ) {
93+ function onPointerUp ( event : SyntheticEvent ) {
94+ if ( event . target instanceof Element && isInsideButton ( event . target ) ) {
95+ // do not expand the context menu if you clicked a button
96+ return ;
97+ }
7898 if ( window . getSelection ( ) ?. toString ( ) === '' ) {
7999 setExpanded ( e => ! e ) ;
80100 trackAnalytics ( 'logs.table.row_expanded' , {
You can’t perform that action at this time.
0 commit comments