mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Inspect event key characters, not keyCodes on tag keyUp
(cherry picked from commit f313b4a8fd
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
fa27088b72
commit
0f9b777ccd
@@ -219,13 +219,15 @@ export class DsDynamicTagComponent extends DsDynamicVocabularyComponent implemen
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new tag with typed text when typing 'Enter' or ',' or ';'
|
||||
* Add a new tag with typed text when typing 'Enter' or ','
|
||||
* Tests the key rather than keyCode as keyCodes can vary
|
||||
* based on keyboard layout (and do not consider Shift mod)
|
||||
* @param event the keyUp event
|
||||
*/
|
||||
onKeyUp(event) {
|
||||
if (event.keyCode === 13 || event.keyCode === 188) {
|
||||
if (event.key === 'Enter' || event.key === ',') {
|
||||
event.preventDefault();
|
||||
// Key: 'Enter' or ',' or ';'
|
||||
// Key: 'Enter' or ','
|
||||
this.addTagsToChips();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
Reference in New Issue
Block a user