-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b0e731
commit 4c8448d
Showing
7 changed files
with
43 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { QuickformState } from "../state"; | ||
|
||
/** | ||
* Determines if the provided question is the first in the current slide and if it should receive autofocus. | ||
* The method checks if any question on the slide has been visited, and if so, it will not autofocus the first question. | ||
* @param questionLogicalName The logical name of the question to check. | ||
* @returns boolean indicating if the question is the first and should be autofocused. | ||
*/ | ||
export const isFirstQInCurrentSlide = (questionLogicalName: string, state: QuickformState): boolean => { | ||
const currSlide = state.slides[state.currIdx]; | ||
if (currSlide.questions && currSlide.questions.length > 0) { | ||
const isFirstQuestion = currSlide.questions[0].logicalName === questionLogicalName; | ||
const anyQuestionVisited = currSlide.questions.some(q => q.visited); | ||
return isFirstQuestion && !anyQuestionVisited; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters