Select next input on closing details element

This commit is contained in:
Florine W. Dekker 2022-11-28 07:51:14 +01:00
parent e7a5f64f60
commit bde4482343
Signed by: FWDekker
GPG Key ID: D3DCFAA8A4560BE0
2 changed files with 7 additions and 13 deletions

View File

@ -1,6 +1,6 @@
{
"name": "doomsday",
"version": "1.5.0",
"version": "1.5.1",
"description": "Test your mastery of Conway's Doomsday rule.",
"author": "Florine W. Dekker",
"browser": "dist/bundle.js",

View File

@ -347,6 +347,8 @@ doAfterLoad(() => {
onToggle(isOpened: boolean): void {
super.onToggle(isOpened);
if (isOpened) centuryInput.selectInput();
else if (yearDetails.isOpened()) yearInput.selectInput();
else if (dayDetails.isOpened()) dayInput.selectInput();
centuryInput.updateTitle();
}
}("century", $("#century-details"));
@ -354,6 +356,8 @@ doAfterLoad(() => {
onToggle(isOpened: boolean): void {
super.onToggle(isOpened);
if (isOpened) yearInput.selectInput();
else if (dayDetails.isOpened()) dayInput.selectInput();
else if (centuryDetails.isOpened()) centuryInput.selectInput();
yearInput.updateTitle();
}
}("year", $("#year-details"));
@ -361,6 +365,8 @@ doAfterLoad(() => {
onToggle(isOpened: boolean): void {
super.onToggle(isOpened);
if (isOpened) dayInput.selectInput();
else if (centuryDetails.isOpened()) centuryInput.selectInput();
else if (yearDetails.isOpened()) yearInput.selectInput();
dayInput.updateTitle();
}
}("day", $("#day-details"));
@ -384,10 +390,6 @@ doAfterLoad(() => {
resetButton.focus();
}
onInvalidInput() {
// Do nothing
}
updateTitle() {
if (centuryDetails.isOpened())
this.titleLabel.innerText = `Anchor day of century starting in ${quizDate.getCentury() * 100}?`;
@ -412,10 +414,6 @@ doAfterLoad(() => {
resetButton.focus();
}
onInvalidInput() {
// Do nothing
}
updateTitle() {
if (yearDetails.isOpened())
this.titleLabel.innerText = `Doomsday of year ${quizDate.date.year}?`;
@ -437,10 +435,6 @@ doAfterLoad(() => {
resetButton.focus();
}
onInvalidInput() {
// Do nothing
}
updateTitle() {
if (dayDetails.isOpened())
this.titleLabel.innerText = `Weekday of ${quizDate.date.toISODate()}?`;