Hi, and thanks as always for the help.
My app needs an TextInput in the header of a Card, so users can type a title for that Card. However, I have a couple of issues with event propagation from that TextInput.
- When a user clicks inside the
TextInput(because the user wants to type in it), the click will also cause the entireCardto collapse (or de-collapse). - When a user types inside the
TextInput, and happens to type a space, the entireCardwill collapse (or de-collapse).
I do realise this is because the event is propagating from the TextInput to the parent Card. How do I fix this behavior?
Code below:
import panel as pn
pn.extension()
header_text = pn.widgets.TextInput(
placeholder='describe your analysis here',
disabled=False,
max_length=255,
width_policy='max',
sizing_mode='stretch_width',
)
header_row = pn.Row(
header_text,
width_policy='max',
sizing_mode='stretch_width',
)
card = pn.Card(
"A line with some text",
header=header_row,
collapsed=False,
collapsible=True,
width_policy='max',
sizing_mode='stretch_width',
)
card.servable()