Repository: Avaiga/taipy

Issue:
[🐛 BUG] Slider with tuple lov forced into multi-selection
### What went wrong? 🤔

Previous demonstrated this in #2290.

Code example:

```python
from taipy.gui import Gui, Icon
import taipy.gui.builder as tgb

aggregation_list = [("minute", "Minute"), ("hour", "Hour"), ("day", "Day"), ("week", "Week")]
selected_aggregation = aggregation_list[0]

with tgb.Page() as page:
    tgb.text("# Single selection for list[tuple[str, str | Icon]] lov", mode="md")
    tgb.slider("{selected_aggregation}", lov="{aggregation_list}", value_by_id=False)
    tgb.text("{selected_aggregation}")

def on_change(state, var_name, var_value):
    print(var_name, type(var_value), var_value)

if __name__ == "__main__":
    gui = Gui(page=page)
    gui.run(run_browser=False, use_reloader=True)
```

Video:

https://github.com/user-attachments/assets/2337d348-3379-4ab1-8dfd-a1e33d474f98




### Expected Behavior

Slider should be single-select.

For multi-selection, `selected_aggregation` should have been initialized to a list (e.g. `[]` or `aggregation_list[:2]`).


### Browsers

Chrome

### OS

Windows, Linux

### Version of Taipy

develop

### Acceptance Criteria

- [ ] A unit test reproducing the bug is added.
- [ ] Any new code is covered by a unit tested.
- [ ] Check code coverage is at least 90%.
- [ ] The bug reporter validated the fix.
- [ ] Related issue(s) in taipy-doc are created for documentation and Release Notes are updated.


### Code of Conduct

- [X] I have checked the [existing issues](https://github.com/Avaiga/taipy/issues?q=is%3Aissue+).
- [ ] I am willing to work on this issue (optional)

Hints from issue comments:
@xyfer17: @arcanaxion I would like to pick this issue.@arcanaxion: @xyfer17 I'm not a maintainer of this project. I'm just here to complain and open issues 😄 @FlorianJacta: This hasn't been yet seen by the maintainers. We should be able to get back on this soon


Solution patch:
diff --git a/taipy/gui/_renderers/_markdown/factory.py b/taipy/gui/_renderers/_markdown/factory.py
index fa47e3baf..a00afb8ba 100644
--- a/taipy/gui/_renderers/_markdown/factory.py
+++ b/taipy/gui/_renderers/_markdown/factory.py
@@ -22,11 +22,11 @@ class _MarkdownFactory(_Factory):
     _TAIPY_BLOCK_TAGS = ["layout", "part", "expandable", "dialog", "pane"]
 
     @staticmethod
-    def create_element(gui, control_type: str, all_properties: str) -> t.Union[t.Any, str]:
+    def create_element(gui, element_type: str, all_properties: str) -> t.Union[t.Any, str]:
         # Create properties dict from all_properties
         property_pairs = _Factory._PROPERTY_RE.findall(all_properties)
         properties = {property[0]: property[1] for property in property_pairs}
-        builder_md = _Factory.call_builder(gui, control_type, properties)
+        builder_md = _Factory.call_builder(gui, element_type, properties)
         if builder_md is None:
-            return f"<|INVALID SYNTAX - Control is '{control_type}'|>"
+            return f"<|UNKNOWN ELEMENT TYPE '{element_type}'|>"
         return builder_md
diff --git a/taipy/gui/utils/_adapter.py b/taipy/gui/utils/_adapter.py
index 8a2de2d80..55faf411b 100644
--- a/taipy/gui/utils/_adapter.py
+++ b/taipy/gui/utils/_adapter.py
@@ -70,7 +70,8 @@ class _Adapter:
         adapter = self.__get_for_var(var_name, value)
         if isclass(lov) and issubclass(lov, Enum):
             lov = list(lov)
-        if isinstance(lov, (list, tuple)):
+        # list or Lov value
+        if isinstance(lov, list) or (isinstance(lov, tuple) and not id_only):
             res = []
             for elt in lov:
                 v = self._run(adapter, elt, var_name, id_only)


Test patch:
diff --git a/tests/gui/renderers/test_md_parsing.py b/tests/gui/renderers/test_md_parsing.py
index fcb7d436d..62877cc34 100644
--- a/tests/gui/renderers/test_md_parsing.py
+++ b/tests/gui/renderers/test_md_parsing.py
@@ -14,7 +14,7 @@ from taipy.gui import Gui
 
 def test_invalid_control_name(gui: Gui, helpers):
     md_string = "<|invalid|invalid|>"
-    expected_list = ["INVALID SYNTAX - Control is 'invalid'"]
+    expected_list = ["UNKNOWN ELEMENT TYPE 'invalid'"]
     helpers.test_control_md(gui, md_string, expected_list)