File tree 1 file changed +21
-1
lines changed
static/app/views/explore/logs 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change
1
+ import type { SyntheticEvent } from 'react' ;
1
2
import { Fragment , useCallback , useState } from 'react' ;
2
3
import { useTheme } from '@emotion/react' ;
3
4
@@ -62,6 +63,21 @@ type LogsRowProps = {
62
63
63
64
const ALLOWED_CELL_ACTIONS : Actions [ ] = [ Actions . ADD , Actions . EXCLUDE ] ;
64
65
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
+
65
81
export function LogRowContent ( {
66
82
dataRow,
67
83
highlightTerms,
@@ -74,7 +90,11 @@ export function LogRowContent({
74
90
const search = useLogsSearch ( ) ;
75
91
const setLogsSearch = useSetLogsSearch ( ) ;
76
92
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
+ }
78
98
if ( window . getSelection ( ) ?. toString ( ) === '' ) {
79
99
setExpanded ( e => ! e ) ;
80
100
trackAnalytics ( 'logs.table.row_expanded' , {
You can’t perform that action at this time.
0 commit comments