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
10 changes: 8 additions & 2 deletions panel/models/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,14 @@ export class CardView extends ColumnView {
}

_toggle_button(e: MouseEvent): void {
for (const path of e.composedPath()) {
if (path instanceof HTMLInputElement) {
const is_panel_widget = (el: EventTarget): boolean =>
el instanceof HTMLInputElement || (
el instanceof HTMLElement &&
Array.from(el.classList).some((c) => c.startsWith("bk-panel-models-widgets-")))

for (const el of e.composedPath()) {
// If the click came from any Panel widget in the header, don't toggle.
if (is_panel_widget(el)) {
return
}
}
Expand Down
6 changes: 5 additions & 1 deletion panel/tests/ui/layout/test_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_card_scrollable(page):
def test_card_widget_not_collapsed(page, card_components):
# Fixes https://github.com/holoviz/panel/issues/7045
w1, w2 = card_components
card = Card(w1, header=Row(w2))
card = Card("content", title="MyTitle", header=Row(w1, w2))

serve_component(page, card)

Expand All @@ -199,5 +199,9 @@ def test_card_widget_not_collapsed(page, card_components):
text_input.press("F")
text_input.press("Enter")

slider_input = page.locator('.noUi-base')
expect(slider_input).to_have_count(1)
slider_input.click()

wait_until(lambda: w2.value == 'F', page)
assert not card.collapsed
Loading