mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Stop mouseup propagation while inspecting
This commit is contained in:
@@ -320,6 +320,7 @@ export default class Agent extends EventEmitter {
|
||||
startInspectingDOM = () => {
|
||||
window.addEventListener('click', this._onClick, true);
|
||||
window.addEventListener('mousedown', this._onMouseDown, true);
|
||||
window.addEventListener('mouseup', this._onMouseUp, true);
|
||||
window.addEventListener('mouseover', this._onMouseOver, true);
|
||||
};
|
||||
|
||||
@@ -339,6 +340,7 @@ export default class Agent extends EventEmitter {
|
||||
|
||||
window.removeEventListener('click', this._onClick, true);
|
||||
window.removeEventListener('mousedown', this._onMouseDown, true);
|
||||
window.removeEventListener('mouseup', this._onMouseUp, true);
|
||||
window.removeEventListener('mouseover', this._onMouseOver, true);
|
||||
};
|
||||
|
||||
@@ -408,6 +410,14 @@ export default class Agent extends EventEmitter {
|
||||
}
|
||||
};
|
||||
|
||||
// While we don't do anything here, this makes choosing
|
||||
// the inspected element less invasive and less likely
|
||||
// to dismiss e.g. a context menu.
|
||||
_onMouseUp = (event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
_onMouseOver = (event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
Reference in New Issue
Block a user