Auto-focus input after adding new row

This commit is contained in:
Florine W. Dekker 2021-11-14 11:14:16 +01:00
parent e4862b60ad
commit b04d4b12df
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
3 changed files with 11 additions and 20 deletions

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,6 +1,6 @@
{
"name": "dice",
"version": "1.0.15",
"version": "1.0.16",
"description": "Calculates the probability of rolling a value given a combination of dice.",
"author": "F.W. Dekker",
"browser": "dist/bundle.js",
@ -16,18 +16,18 @@
"deploy": "grunt deploy"
},
"dependencies": {
"chart.js": "^3.2.0"
"chart.js": "^3.6.0"
},
"devDependencies": {
"grunt": "^1.4.0",
"grunt-cli": "^1.4.2",
"grunt": "^1.4.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-focus": "^1.0.0",
"grunt-text-replace": "^0.4.0",
"grunt-webpack": "^4.0.3",
"webpack": "^5.36.0",
"webpack-cli": "^4.6.0"
"grunt-webpack": "^5.0.0",
"webpack": "^5.64.0",
"webpack-cli": "^4.9.1"
}
}

View File

@ -98,7 +98,6 @@ inputTable.addDieRow = () => {
if (e.key === "Enter")
outputChart.updateProbGraph();
});
input.focus();
return input;
};
@ -122,6 +121,8 @@ inputTable.addDieRow = () => {
row.insertCell().appendChild(createNumberInput(newIndex, "dieEyes", 6));
row.insertCell().appendChild(createNumberInput(newIndex, "dieCount", 2));
row.insertCell().appendChild(createRemoveLink(newIndex, "dieRemove"));
$("#dieEyes" + newIndex).focus();
};
inputTable.removeDieRow = index => {
@ -152,7 +153,7 @@ inputTable.getDice = () => {
doAfterLoad(() => {
const button = $("#addDieRowButton");
button.onclick = inputTable.addDieRow;
button.click()
button.click();
});
@ -215,17 +216,7 @@ doAfterLoad(() => {
probChart = new Chart($("#probChart").getContext("2d"), {
type: "line",
data: {},
options: {
fill: true,
scales: {
yAxes: [{
display: true,
ticks: {
suggestedMin: 0
}
}]
}
}
options: {fill: true},
});
const submit = $("#submit");