Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PeoplePicker selectionMode="single" #1997

Closed
masashiswingle opened this issue Jan 20, 2023 · 2 comments · Fixed by #2033
Closed

[BUG] PeoplePicker selectionMode="single" #1997

masashiswingle opened this issue Jan 20, 2023 · 2 comments · Fixed by #2033

Comments

@masashiswingle
Copy link
Contributor

Describe the bug

The Peoplepicker will error when removing a single user when selectionMode="single".

I think the issue is when selectionMode is set to "single" and a person is selected, the input stops being rendered so you cannot select more people. When trying to remove a user, the removePerson handler is called where it tries to call this.input.focus() even though this.input = null. See screenshot for reference. The solution is to wrap this.input.focus in a null checker to make sure it is defined like other handlers.

To Reproduce
Steps to reproduce the behavior:

  1. Render a PeoplePicker component with the prop selectionMode="single"
  2. Add a person
  3. Remove person
  4. See error
    Unhandled Runtime Error
    TypeError: Cannot read properties of null (reading 'focus')

Call Stack
MgtPeoplePicker.removePerson
node_modules@microsoft\mgt-components\dist\es6\components\mgt-people-picker\mgt-people-picker.js (875:0)

Expected behavior
Remove person without erroring.

Screenshots
Error_peoplepicker

Environment (please complete the following information):

  • OS: Windows 11
  • Browser Chrome:latest
  • Framework React
  • Context Microsoft Teams
  • Version
    "@microsoft/mgt-react": "2.7.1-preview.a5e3807",
    "@microsoft/mgt-teamsfx-provider": "2.7.1-preview.a5e3807",
    "@microsoft/microsoft-graph-client": "^3.0.2",
  • Provider [e.g. Msal2Provider] (bonus if you share the provider config)

Additional context
Add any other context about the problem here.

@masashiswingle masashiswingle added bug Something isn't working Needs: Triage 🔍 labels Jan 20, 2023
@ghost
Copy link

ghost commented Jan 20, 2023

Hello masashiswingle, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@musale
Copy link
Contributor

musale commented Jan 23, 2023

Good catch @masashiswingle! I was able to reproduce this for teams-fx app. Would you be interested in making a fix for it?

@ghost ghost added the State: In Review label Feb 9, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants