Skip to content

Commit

Permalink
Merge pull request #3557 from serlo/fix/blank-alternative-answer-safa…
Browse files Browse the repository at this point in the history
…ri-focus-bug

fix(plugin-blanks): alternative answers safari focus bug
  • Loading branch information
elbotho authored Mar 26, 2024
2 parents 3e9c0de + 763f610 commit 2f4aa03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export function BlankRenderer(props: BlankRendererProps) {
}

function handleAlternativeAnswerAdd() {
ReactEditor.blur(editor)
setCorrectAnswers([...correctAnswers, { answer: '' }])
}

Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/store/focus/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export const focusSlice = createSlice({
},
focusPrevious(state, action: PayloadAction<ChildTreeNode | null>) {
if (!state || !action.payload) return state
const next = findPreviousChildTreeNode(action.payload, state)
if (!next) return state
return next
const previous = findPreviousChildTreeNode(action.payload, state)
if (!previous) return state
return previous
},
},
extraReducers: (builder) => {
Expand Down

0 comments on commit 2f4aa03

Please sign in to comment.