Skip to content

Commit 7bd958e

Browse files
musalegavinbarron
andauthored
fix: show the dropdown when you focus on the people picker with tab key (#1902)
* update: call gainedFocus on focusing on input * update: Remove tab actions from adding a person * update: Remove unecessary comment Co-authored-by: Gavin Barron <[email protected]>
1 parent 41de8c4 commit 7bd958e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packages/mgt-components/src/components/mgt-people-picker/mgt-people-picker.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
705705
aria-autocomplete="list"
706706
aria-expanded="false"
707707
tabindex="0"
708+
@focus="${this.gainedFocus}"
708709
@keydown="${this.onUserKeyDown}"
709710
@keyup="${this.onUserKeyUp}"
710711
@blur=${this.lostFocus}
@@ -1424,13 +1425,6 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
14241425
return;
14251426
}
14261427

1427-
if (event.code === 'Tab' && !this.flyout.isOpen) {
1428-
// keyCodes capture: tab (9)
1429-
if (this.allowAnyEmail) {
1430-
this.gainedFocus();
1431-
}
1432-
}
1433-
14341428
if (event.shiftKey) {
14351429
this.gainedFocus();
14361430
}
@@ -1574,9 +1568,8 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
15741568
}
15751569

15761570
const input = event.target as HTMLInputElement;
1577-
if (event.code === 'Tab' || event.code === 'Enter') {
1571+
if (event.code === 'Enter') {
15781572
if (!event.shiftKey && this._foundPeople) {
1579-
// keyCodes capture: tab (9) and enter (13)
15801573
event.preventDefault();
15811574
event.stopPropagation();
15821575
if (this._foundPeople.length) {

0 commit comments

Comments
 (0)