Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

* Restricted the allowable types of the `choices` parameter of `input_select()`, `input_selectize()`, `update_select()`, and `update_selectize()` to actual set of allowable types (previously, the type was suggesting HTML-like values were supported). (#2048)

* Improved the styling and readability of markdown tables rendered by `ui.Chat()` and `ui.MarkdownStream()`. (#1973)

* `selectize`, `remove_button`, and `options` parameters of `ui.input_select()` have been deprecated; use `ui.input_selectize()` instead. (Thanks, @ErdaradunGaztea!) (#1947)
Expand All @@ -39,6 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

* Fixed an issue with `update_selectize()` to properly display labels with HTML reserved characters like "&" (#1330)

* Fixed an issue with `ui.Chat()` sometimes wanting to scroll a parent element. (#1996)

* Explicitly call out module usage in UI input bookmark button documentation. (#1983)
Expand Down
14 changes: 3 additions & 11 deletions shiny/ui/_input_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ._html_deps_external import selectize_deps
from ._utils import JSEval, extract_js_keys, shiny_input_label

_Choices = Mapping[str, TagChild]
_Choices = Mapping[str, str]
_OptGrpChoices = Mapping[str, _Choices]

# Canonical format for representing select options.
Expand Down Expand Up @@ -75,8 +75,7 @@ def input_selectize(
choices
Either a list of choices or a dictionary mapping choice values to labels. Note
that if a dictionary is provided, the keys are used as the (input) values and
the values are labels displayed to the user. It is not recommended to use
anything other than a string for these labels. A dictionary of dictionaries is
the values are labels displayed to the user. A dictionary of dictionaries is
also supported, and in that case, the top-level keys are treated as
``<optgroup>`` labels.
selected
Expand Down Expand Up @@ -157,8 +156,7 @@ def input_select(
choices
Either a list of choices or a dictionary mapping choice values to labels. Note
that if a dictionary is provided, the keys are used as the (input) values and
the values are labels displayed to the user. It is not recommended to use
anything other than a string for these labels. A dictionary of dictionaries is
the values are labels displayed to the user. A dictionary of dictionaries is
also supported, and in that case, the top-level keys are treated as
``<optgroup>`` labels.
selected
Expand Down Expand Up @@ -259,12 +257,6 @@ def _input_select_impl(

choices_ = _normalize_choices(choices)

if _contains_html(choices_):
warn_deprecated(
"Passing anything other than a string to `choices` parameter of "
"`input_select()` and `input_selectize()` is deprecated."
)

selected = restore_input(resolved_id, selected)
if selected is None and not multiple:
selected = _find_first_option(choices_)
Expand Down
14 changes: 4 additions & 10 deletions shiny/ui/_input_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ def update_select(
An input label.
choices
Either a list of choices or a dictionary mapping choice values to labels. Note
that if a dictionary is provided, the keys are used as the (input) values so
that the dictionary values can hold HTML labels. A dictionary of dictionaries is
that if a dictionary is provided, the keys are used as the (input) values. A dictionary of dictionaries is
also supported, and in that case, the top-level keys are treated as
``<optgroup>`` labels.
selected
Expand Down Expand Up @@ -697,8 +696,7 @@ def update_selectize(
An input label.
choices
Either a list of choices or a dictionary mapping choice values to labels. Note
that if a dictionary is provided, the keys are used as the (input) values so
that the dictionary values can hold HTML labels. A dictionary of dictionaries is
that if a dictionary is provided, the keys are used as the (input) values. A dictionary of dictionaries is
also supported, and in that case, the top-level keys are treated as
``<optgroup>`` labels.
selected
Expand Down Expand Up @@ -746,15 +744,11 @@ def update_selectize(
if choices is not None:
for k, v in _normalize_choices(choices).items():
if not isinstance(v, Mapping):
flat_choices.append(
FlatSelectChoice(value=k, label=session._process_ui(v)["html"])
)
flat_choices.append(FlatSelectChoice(value=k, label=v))
else: # The optgroup case
flat_choices.extend(
[
FlatSelectChoice(
optgroup=k, value=k2, label=session._process_ui(v2)["html"]
)
FlatSelectChoice(optgroup=k, value=k2, label=v2)
for (k2, v2) in v.items()
]
)
Expand Down
Loading