mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 16:26:43 +00:00
Prevent possible parent action-row from switching to yamlMode (#9883)
* Prevent possible parent action-row from switching to yamlMode Now that we have the choose-action, it's possible to have nested action-rows. If an action contains a template, we should only switch that action-row to yamlMode instead of all action-rows. By canceling the bubbling on the first encouter we prevent the event from bubbling upwards to parent action-rows. * Prevent possible parent action-row from also moving Now that we have the choose-action, it's possible to have nested action-rows. If an action inside a choose-action is moved, we should only move that action-row instead of both the action-row and its parents. By canceling the bubbling on the first encouter we prevent the event from bubbling upwards to parent action-rows. * Apply suggestions from code review Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
900efe8a36
commit
640fbd616b
@ -252,6 +252,9 @@ export default class HaAutomationActionRow extends LitElement {
|
||||
}
|
||||
|
||||
private _handleUiModeNotAvailable(ev: CustomEvent) {
|
||||
// Prevent possible parent action-row from switching to yamlMode
|
||||
ev.stopPropagation();
|
||||
|
||||
this._warnings = handleStructError(this.hass, ev.detail).warnings;
|
||||
if (!this._yamlMode) {
|
||||
this._yamlMode = true;
|
||||
|
@ -53,6 +53,9 @@ export default class HaAutomationAction extends LitElement {
|
||||
}
|
||||
|
||||
private _move(ev: CustomEvent) {
|
||||
// Prevent possible parent action-row from also moving
|
||||
ev.stopPropagation();
|
||||
|
||||
const index = (ev.target as any).index;
|
||||
const newIndex = ev.detail.direction === "up" ? index - 1 : index + 1;
|
||||
const actions = this.actions.concat();
|
||||
|
Loading…
x
Reference in New Issue
Block a user