@samitouri / QOS-React / commits / 18e337707a

Stop mouseup propagation while inspecting

Dan Abramov committed Apr 4, 2019 at 19:50 UTC 18e337707a9dbfcd380deced8901cd1ec880d496
1 file changed +10
src/backend/agent.js
+10
@@ -320,6 +320,7 @@ export default class Agent extends EventEmitter {
320 startInspectingDOM = () => {
321 window.addEventListener('click', this._onClick, true);
322 window.addEventListener('mousedown', this._onMouseDown, true);
323 + window.addEventListener('mouseup', this._onMouseUp, true);
324 window.addEventListener('mouseover', this._onMouseOver, true);
325 };
326
@@ -339,6 +340,7 @@ export default class Agent extends EventEmitter {
340
341 window.removeEventListener('click', this._onClick, true);
342 window.removeEventListener('mousedown', this._onMouseDown, true);
343 + window.removeEventListener('mouseup', this._onMouseUp, true);
344 window.removeEventListener('mouseover', this._onMouseOver, true);
345 };
346
@@ -408,6 +410,14 @@ export default class Agent extends EventEmitter {
410 }
411 };
412
413 + // While we don't do anything here, this makes choosing
414 + // the inspected element less invasive and less likely
415 + // to dismiss e.g. a context menu.
416 + _onMouseUp = (event: MouseEvent) => {
417 + event.preventDefault();
418 + event.stopPropagation();
419 + };
420 +
421 _onMouseOver = (event: MouseEvent) => {
422 event.preventDefault();
423 event.stopPropagation();