Skip to content

Commit

Permalink
fix focus on tab-select
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Feb 22, 2025
1 parent e876670 commit 5f135dc
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 15 deletions.
60 changes: 55 additions & 5 deletions dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeInvisible()
this.elements.randomWordGenerateButton.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.randomWordGenerateButton.focus()
setTimeout(
() => {
this.elements.randomWordGenerateButton.focus()
},
500,
)

this.generateRandomWords()
},
"urlShorthand": "random",
Expand All @@ -953,7 +963,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.logAt0("SWTICH TO NGRAM MODE")
this.elements.matchLengthsRow.makeInvisible()
this.elements.ngramGenerateButton.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.ngramGenerateButton.focus()
setTimeout(
() => {
this.elements.ngramGenerateButton.focus()
},
500,
)

this.ngramsKeeper = null
this.generateNGramWords()
},
Expand All @@ -969,7 +989,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeVisible()
this.elements.patternLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.patternLettersElement.focus()
setTimeout(
() => {
this.elements.patternLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "pattern",
Expand All @@ -984,7 +1014,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeInvisible()
this.elements.anagramLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.anagramLettersElement.focus()
setTimeout(
() => {
this.elements.anagramLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "anagram",
Expand All @@ -1001,7 +1041,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeVisible()
this.elements.requiredLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.requiredLettersElement.focus()
setTimeout(
() => {
this.elements.requiredLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "bee",
Expand Down
60 changes: 55 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeInvisible()
this.elements.randomWordGenerateButton.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.randomWordGenerateButton.focus()
setTimeout(
() => {
this.elements.randomWordGenerateButton.focus()
},
500,
)

this.generateRandomWords()
},
"urlShorthand": "random",
Expand All @@ -953,7 +963,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.logAt0("SWTICH TO NGRAM MODE")
this.elements.matchLengthsRow.makeInvisible()
this.elements.ngramGenerateButton.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.ngramGenerateButton.focus()
setTimeout(
() => {
this.elements.ngramGenerateButton.focus()
},
500,
)

this.ngramsKeeper = null
this.generateNGramWords()
},
Expand All @@ -969,7 +989,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeVisible()
this.elements.patternLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.patternLettersElement.focus()
setTimeout(
() => {
this.elements.patternLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "pattern",
Expand All @@ -984,7 +1014,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeInvisible()
this.elements.anagramLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.anagramLettersElement.focus()
setTimeout(
() => {
this.elements.anagramLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "anagram",
Expand All @@ -1001,7 +1041,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeVisible()
this.elements.requiredLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.requiredLettersElement.focus()
setTimeout(
() => {
this.elements.requiredLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "bee",
Expand Down
60 changes: 55 additions & 5 deletions staging.html
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeInvisible()
this.elements.randomWordGenerateButton.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.randomWordGenerateButton.focus()
setTimeout(
() => {
this.elements.randomWordGenerateButton.focus()
},
500,
)

this.generateRandomWords()
},
"urlShorthand": "random",
Expand All @@ -953,7 +963,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.logAt0("SWTICH TO NGRAM MODE")
this.elements.matchLengthsRow.makeInvisible()
this.elements.ngramGenerateButton.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.ngramGenerateButton.focus()
setTimeout(
() => {
this.elements.ngramGenerateButton.focus()
},
500,
)

this.ngramsKeeper = null
this.generateNGramWords()
},
Expand All @@ -969,7 +989,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeVisible()
this.elements.patternLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.patternLettersElement.focus()
setTimeout(
() => {
this.elements.patternLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "pattern",
Expand All @@ -984,7 +1014,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeInvisible()
this.elements.anagramLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.anagramLettersElement.focus()
setTimeout(
() => {
this.elements.anagramLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "anagram",
Expand All @@ -1001,7 +1041,17 @@ <h1><span class="boxed-text rounded">Word Finder</span></h1>
"callback": () => {
this.ngramsKeeper = null
this.elements.matchLengthsRow.makeVisible()
this.elements.requiredLettersElement.focus()

// The tab button being clicked gets the focus.
// So we have to delay.
// this.elements.requiredLettersElement.focus()
setTimeout(
() => {
this.elements.requiredLettersElement.focus()
},
500,
)

this.showMatches()
},
"urlShorthand": "bee",
Expand Down

0 comments on commit 5f135dc

Please sign in to comment.