Skip to content

Commit 3076dc7

Browse files
authored
fix: Bug when adding spaces to containers names in course outline (#2825)
- Fixes the bug introduced in #2732 - Removes the unnecessary `preventDefault`
1 parent a23a4da commit 3076dc7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/course-outline/card-header/CardHeader.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,14 @@ const CardHeader = ({
178178
onChange={(e) => setTitleValue(e.target.value)}
179179
aria-label={intl.formatMessage(messages.editFieldAriaLabel)}
180180
onBlur={() => onEditSubmit(titleValue)}
181-
onKeyDown={(e) => {
181+
onKeyDown={/* istanbul ignore next */ (e) => {
182182
if (e.key === 'Enter') {
183183
onEditSubmit(titleValue);
184+
} else if (e.key === ' ') {
185+
// Avoid passing propagation to the `SortableItem` in the card,
186+
// which executes a `preventDefault`. If propagation is not prevented,
187+
// spaces cannot be added to names.
188+
e.stopPropagation();
184189
}
185190
}}
186191
disabled={isSaving}

0 commit comments

Comments
 (0)