File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -918,12 +918,12 @@ class ButtonCard extends LitElement {
918
918
< div
919
919
id =${ key }
920
920
@action =${ this . _stopPropagation }
921
- @click=${ this . _stopPropagation }
922
- @touchstart=${ this . _stopPropagation }
923
- @mousedown=${ this . _stopPropagation }
924
- @mouseup=${ this . _stopPropagation }
925
- @touchend=${ this . _stopPropagation }
926
- @touchcancel=${ this . _stopPropagation }
921
+ @click=${ this . _sendToParent }
922
+ @touchstart=${ this . _sendToParent }
923
+ @mousedown=${ this . _sendToParent }
924
+ @mouseup=${ this . _sendToParent }
925
+ @touchend=${ this . _sendToParent }
926
+ @touchcancel=${ this . _sendToParent }
927
927
style=${ styleMap ( customStyle ) }
928
928
>
929
929
${ thing }
@@ -1526,4 +1526,10 @@ class ButtonCard extends LitElement {
1526
1526
private _stopPropagation ( ev : Event ) : void {
1527
1527
ev . stopPropagation ( ) ;
1528
1528
}
1529
+
1530
+ private _sendToParent ( ev : Event ) : void {
1531
+ ev . stopPropagation ( ) ;
1532
+ const event = new CustomEvent ( ev . type , ev ) ;
1533
+ this . parentElement ?. dispatchEvent ( event ) ;
1534
+ }
1529
1535
}
Original file line number Diff line number Diff line change @@ -1471,6 +1471,9 @@ views:
1471
1471
entity : switch.skylight
1472
1472
show_icon : false
1473
1473
name : ' [[[ return `Main entity: ${entity.entity_id || "unknown entity"}`; ]]]'
1474
+ label : Tap should toggle
1475
+ tap_action :
1476
+ action : toggle
1474
1477
styles :
1475
1478
grid :
1476
1479
- grid-template-areas : ' "n" "nested"'
@@ -1482,7 +1485,13 @@ views:
1482
1485
type : ' custom:button-card'
1483
1486
name : ' [[[[ return (entity?.entity_id || "4[ ]: main button entity not known"); ]]]]'
1484
1487
label : ' [[[ return `3[ ]: ${(entity?.entity_id || "main button state not known")}`; ]]]'
1488
+ show_state : true
1489
+ state_display : Above should show "not known" <br/> below should show ¨switch.skylight".<br/>Tap should not trigger parent button action
1485
1490
show_label : true
1491
+ show_icon : false
1492
+ tap_action :
1493
+ action : more-info
1494
+ entity : switch.skylight
1486
1495
1487
1496
- type : custom:button-card
1488
1497
entity : switch.skylight
You can’t perform that action at this time.
0 commit comments