Bug 1251492 - Don't prevent default behavior of unrelated mouse events in HSplitBox. r=linclark

This commit is contained in:
Nick Fitzgerald 2016-03-02 11:05:00 -05:00
parent 74c6f50e80
commit f92f7a7fae
2 changed files with 10 additions and 2 deletions

View File

@ -69,11 +69,19 @@ module.exports = createClass({
},
_onMouseDown(event) {
if (event.button !== 0) {
return;
}
this.setState({ mouseDown: true });
event.preventDefault();
},
_onMouseUp(event) {
if (event.button !== 0 || !this.state.mouseDown) {
return;
}
this.setState({ mouseDown: false });
event.preventDefault();
},

View File

@ -80,7 +80,7 @@ window.onload = Task.async(function* () {
const splitter = document.querySelector(".h-split-box-splitter");
ok(splitter, "Should get our splitter");
synthesizeMouseAtCenter(splitter, { button: 1, type: "mousedown" }, window);
synthesizeMouseAtCenter(splitter, { button: 0, type: "mousedown" }, window);
function mouseMove(clientX) {
const event = new MouseEvent("mousemove", { clientX });
@ -103,7 +103,7 @@ window.onload = Task.async(function* () {
is(newSizes.length, 4, "Should get 4 resizes");
ok(aboutEq(newSizes[3], .75), "New size should be ~.75");
synthesizeMouseAtCenter(splitter, { button: 1, type: "mouseup" }, window);
synthesizeMouseAtCenter(splitter, { button: 0, type: "mouseup" }, window);
// Now that we have let go of the splitter, mouse moves should not result in resizes.