Skip to content

Commit

Permalink
Merge pull request mozilla-services#4869 from testeaxeax/issue-4652
Browse files Browse the repository at this point in the history
Fix mozilla-services#4652, bring textbox into view when refocusing
  • Loading branch information
chenba authored Sep 13, 2018
2 parents 2d4bef5 + c508586 commit f9d7b65
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/src/pages/shot/text-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ exports.TextTool = class TextTool extends React.Component {
this.setState({color, colorName});

const txtInput = this.textInput.current;
txtInput.focus();
if (!this.isElementInViewPort(txtInput)) {
txtInput.scrollIntoView({block: "center"});
}
txtInput.focus();
}

onDragMouseDown(e) {
Expand Down Expand Up @@ -260,15 +260,20 @@ exports.TextTool = class TextTool extends React.Component {
const txtInput = this.textInput.current;

this.setState({textSize: size});
txtInput.focus();
if (!this.isElementInViewPort(txtInput)) {
txtInput.scrollIntoView({block: "center"});
}
txtInput.focus();
}

onInput() {
const txtInput = this.textInput.current;

hasFirstInput = true;
this.adjustX();
if (!this.isElementInViewPort(txtInput)) {
txtInput.scrollIntoView({block: "center"});
}
}

adjustWidth() {
Expand Down

0 comments on commit f9d7b65

Please sign in to comment.