Skip to content

Commit

Permalink
fix: enter email keypress behavior (#2928)
Browse files Browse the repository at this point in the history
updated the keydown for the people-picker behavior to ensure that tab and enter can be used to enter email addresses when the allow-any-email attribute is present
  • Loading branch information
gavinbarron authored Jan 5, 2024
1 parent f2547d1 commit 53b291c
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1607,25 +1607,29 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
if (this.hasMaxSelections) {
this.disableTextInput();
}
return;
}
} else if (this.allowAnyEmail) {
}

if (this.allowAnyEmail) {
this.handleAnyEmail();
} else {
this.showFlyout();
}
}

if (keyName === 'Tab') {
this.hideFlyout();
}

if ([';', ','].includes(keyName)) {
if ([';', ',', 'Tab'].includes(keyName)) {
if (this.allowAnyEmail) {
event.preventDefault();
// need to ensure the tab key does tab things
if ('Tab' !== keyName) event.preventDefault();
this.userInput = this.input.value;
this.handleAnyEmail();
}
}
// need to ensure that the tab key hides the flyout even if the input doesn't have an email address
if (keyName === 'Tab') {
this.hideFlyout();
}
};

/**
Expand Down

0 comments on commit 53b291c

Please sign in to comment.