File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
front_end/ui/components/tooltips Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,16 @@ describe('Tooltip', () => {
95
95
assert . isFalse ( container . querySelector ( 'devtools-tooltip' ) ?. open ) ;
96
96
} ) ;
97
97
98
+ it ( 'should not be activated if dragged' , async ( ) => {
99
+ const container = renderTooltip ( ) ;
100
+
101
+ const button = container . querySelector ( 'button' ) ;
102
+ button ?. dispatchEvent ( new MouseEvent ( 'mouseenter' , { buttons : 1 } ) ) ;
103
+
104
+ await checkForPendingActivity ( ) ;
105
+ assert . isFalse ( container . querySelector ( 'devtools-tooltip' ) ?. open ) ;
106
+ } ) ;
107
+
98
108
it ( 'should not be activated if un-focused' , async ( ) => {
99
109
const container = renderTooltip ( ) ;
100
110
@@ -171,7 +181,7 @@ describe('Tooltip', () => {
171
181
} ) ;
172
182
173
183
it ( 'should print a warning if rich tooltip is used with wrong aria label on anchor' , ( ) => {
174
- const consoleSpy = sinon . spy ( console , 'warn' ) ;
184
+ const consoleSpy = sinon . stub ( console , 'warn' ) ;
175
185
renderTooltip ( { variant : 'rich' } ) ;
176
186
sinon . assert . calledOnce ( consoleSpy ) ;
177
187
} ) ;
Original file line number Diff line number Diff line change @@ -156,7 +156,11 @@ export class Tooltip extends HTMLElement {
156
156
this . #anchorObserver?. disconnect ( ) ;
157
157
}
158
158
159
- showTooltip = ( ) : void => {
159
+ showTooltip = ( event ?: MouseEvent | FocusEvent ) : void => {
160
+ // Don't show the tooltip if the mouse is down.
161
+ if ( event && 'buttons' in event && event . buttons ) {
162
+ return ;
163
+ }
160
164
if ( this . #timeout) {
161
165
window . clearTimeout ( this . #timeout) ;
162
166
}
You can’t perform that action at this time.
0 commit comments