home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.01k stars 2.74k forks source link

fire-dom-event gets replaced with '' inside the visual editor #19379

Closed pazoozoo123 closed 9 months ago

pazoozoo123 commented 9 months ago

Checklist

Describe the issue you are experiencing

In my production install I am using browser mod and it requires the action fire-dom-event for frontend events on browsers. I like using the dashboard visual editor to edit both HA and custom cards with not supported cards just using the built in YAML editing capability of the visual editor. I wanted to add a button with the fire-dom-event action but as soon as I typed fire-dom-event after the action in the YAML editor it deleted all of the action parameters I had typed in and replaced the fire-dom-event text with '' so basically this:

show_name: true
show_icon: true
type: button
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      browser_id: THIS
      dismissable: true
      title: Test
      content: Test
entity: tts.google_en_com

turned into this:

show_name: true
show_icon: true
type: button
tap_action:
  action: ''
entity: tts.google_en_com

and the familiar not supported message appeared at the bottom of the editor notifying me:

Visual editor is not supported for this configuration: The provided value for 'tap_action.action' is not supported by the visual editor. We support (one of "none","toggle","more-info","call-service","url","navigate","assist") but received (""). You can still edit your config in YAML.

At this point I can type fire-dom-event instead of the '', restore my previous parameters and the not supported message goes away (as if suddenly fire-dom-event action is a legit visual editor selection?) and if I click save the button will work however, when I come back to edit the button again it nullifies my button config again and replaces fire-dom-event with ''.

Note: all of my testing for this PR is done on a bare bone stock HA docker with just the basic on boarding done, no custom add-ons (no browser_mod) or anything.

Describe the behavior you expected

I expect the visual editor to work properly in YAML editor mode and not replace the fire-dom-event with '' and also maintain the fire-dom-event if I open up the editor at a later date. Also the "not supported" message should not go away if you type fire-dom-event again as it is still considered not supported.

Steps to reproduce the issue

  1. Spin up a fresh copy of latest HA in docker and preform on boarding until you have a working instance
  2. Create a new dashboard named "test"
  3. Edit the dashboard and a horizontal stack to it
  4. Add two button cards to the horizontal stack
  5. On the second button switch to code editing mode ({} button) and try typing fire-dom-event after the "action:" below "tap_action:"
  6. Note that as soon as you finish typing the fire-dom-event is replaced with '' and the not supported message appears
  7. You can now type fire-dom-event again over the '' and it is not replaced by '' and the not supported message goes away.
  8. Save and go back to the dashboard then click edit and go back to button 2
  9. Note that we are back to '' and the unsupported message

What version of Home Assistant Core has the issue?

2024.1.3

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox 121.0.1, Edge 120.0.2210.121

Which operating system are you using to run this browser?

Windows 10 Pro 22H2

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

karwosts commented 9 months ago

Thanks for reporting. I have fixed the issue, so you shouldn't see the problem anymore after next month's update.