fix: Bug when adding spaces to containers names in course outline (#2825)

- Fixes the bug introduced in https://github.com/openedx/frontend-app-authoring/pull/2732
- Removes the unnecessary `preventDefault`
This commit is contained in:
Chris Chávez
2026-01-15 09:12:35 -05:00
committed by GitHub
parent a23a4da0a2
commit 3076dc7598

View File

@@ -178,9 +178,14 @@ const CardHeader = ({
onChange={(e) => setTitleValue(e.target.value)}
aria-label={intl.formatMessage(messages.editFieldAriaLabel)}
onBlur={() => onEditSubmit(titleValue)}
onKeyDown={(e) => {
onKeyDown={/* istanbul ignore next */ (e) => {
if (e.key === 'Enter') {
onEditSubmit(titleValue);
} else if (e.key === ' ') {
// Avoid passing propagation to the `SortableItem` in the card,
// which executes a `preventDefault`. If propagation is not prevented,
// spaces cannot be added to names.
e.stopPropagation();
}
}}
disabled={isSaving}