Skip to content

multiselect with max_selections set shows warning when max_selection number of selections are made #6192

@roehnan

Description

@roehnan

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

The max_selections entry for multiselect triggers a warning when the number of selections == max_selections.

Reproducible Code Example

import streamlit as st

sel = st.multiselect("select user", options=['joshua', 'michelle', 'sarah'], max_selections=1)

print('you selected: ', sel)

Steps To Reproduce

Select one of the options and see the warning displayed in the multiselect.

Expected Behavior

The selection is made without displaying the warning.

Current Behavior

max_selections=1
image

max_selections=2
image

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.19.0
  • Python version: 3.10.10
  • Operating System: Fedora 36
  • Browser: Brave v1.48.171
  • Virtual environment:

Additional Information

No response

Are you willing to submit a PR?

  • Yes, I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions