Skip to content

Commit d9857a7

Browse files
committed
Merge branch 'main' into fix-bistream-download-cache
2 parents 6a58e49 + 5331ff6 commit d9857a7

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/app/collection-page/collection-form/collection-form.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { MetadataValue } from '../../core/shared/metadata.models';
2222
import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
2323
import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models';
2424
import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type';
25+
import { hasNoValue, isNotNull } from 'src/app/shared/empty.util';
26+
2527

2628
/**
2729
* Form used for creating and editing collections
@@ -66,6 +68,12 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
6668
super(formService, translate, notificationsService, authService, requestService, objectCache);
6769
}
6870

71+
ngOnInit(): void {
72+
if (hasNoValue(this.formModel) && isNotNull(this.dso)) {
73+
this.initializeForm();
74+
}
75+
}
76+
6977
/**
7078
* Detect changes to the dso and initialize the form,
7179
* if the dso changes, exists and it is not the first change

src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
(blur)="onBlur($event)"
2424
(click)="$event.stopPropagation(); openDropdown(sdRef);"
2525
(focus)="onFocus($event)"
26-
(keypress)="$event.preventDefault()">
26+
(keydown)="selectOnKeyDown($event, sdRef)">
2727
</div>
2828

2929
<div ngbDropdownMenu

src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,23 @@ export class DsDynamicScrollableDropdownComponent extends DsDynamicVocabularyCom
9898
}
9999
}
100100

101+
/**
102+
* KeyDown handler to allow toggling the dropdown via keyboard
103+
* @param event KeyboardEvent
104+
* @param sdRef The reference of the NgbDropdown.
105+
*/
106+
selectOnKeyDown(event: KeyboardEvent, sdRef: NgbDropdown) {
107+
const keyName = event.key;
108+
109+
if (keyName === ' ' || keyName === 'Enter') {
110+
event.preventDefault();
111+
event.stopPropagation();
112+
sdRef.toggle();
113+
} else if (keyName === 'ArrowDown' || keyName === 'ArrowUp') {
114+
this.openDropdown(sdRef);
115+
}
116+
}
117+
101118
/**
102119
* Loads any new entries
103120
*/

0 commit comments

Comments
 (0)