Lovelace Editor inserts chars backwards? How to use external Editor for RAW Code?

I have also this issue in the dashboard code editor.
Usually it happens when I open the code editor of an element, placing the cursor by mouse click.
If the cursor is not at end of line the input changes to rtl.

I notice this behaviour only in HA. I never use rtl-input.
My browser Firefox 64.0.1 64bit, Macos 10.15.7.

Edward

Same thing happening on my setup on Firefox, Safari, and HA. I have not attempted to change rtl/ltl.
I am attempting to find a pattern for the change, but no luck yet.

Mac OSX 10.15.7
Firefox 94.0.1
Safari 15.1
Home Assistant Companion on MacOSX 2021.10(2021.247)

I havenā€™t yet found any pattern when this happens.
either it does, or does not - independent of what exactly I am doingā€¦ but for sure, at some point it will happen.

Same thing here when using Firefox on Windows 10. I switched to Chrome and it hasnā€™t happened since so far, but Iā€™ve also been using the editor less.

Same here. Itā€™s been happening for a while. Currently I am on:
Mac OSX 11.3.1
Firefox 95.0.2
Home Assistant 2021.12.7
Frontend version: 20211229.0

As everyone else, Iā€™m finding it hard to replicate. It does happen almost every time I try to edit, and once it starts I have to reload the tab to stop it. Pasting something into the editor window stops it from happening for a very short while (a few character presses), but not beyond that. Only a reload of the tab works.

When it happens I press ALT+D or Ctrl+L or F6 to focus address bar and then mouse click in the editor or press TAB until cursor is in editor, that changes text direction back to normal without need to reload page or doing some crazy things with keyboard. But yes, it is annoying.

3 Likes

Well itā€™s still an issueā€¦ I just found a much quicker way to change text direction.

Just open new tab with CTRL+T and immediately close it with CTRL+W.

Or just cycle between tabs with CTRL+TAB.

Now you can continue typing in editor with correct text direction.

3 Likes

Also got this issue!

I can reliably reproduce the issue (Firefox, Linux) when within the yaml editor I copy some code and paste it back (or at another location).
Iā€™ve heard something that modern desktop systems insert special markers around text that is pasted, maybe that confuses the yaml editor?

Alas, it happens to me all the time when Iā€™m not copy/pasting, so I donā€™t think thatā€™s the cause. I just go to edit a dashboard card and start typing and itā€™s all backwards. I click outside the text box, then back in, and then it works correctly.

I often have that I type a key, e.g ā€œentity:ā€ and then start typing the name, the characters are inserted backwards, so I type ā†’ after each letter; then after two characters it is normal again.

Was there ever a fix to this? It still seems to be occuring randomly!

1 Like

This is random. Iā€™ve been having this issue for a while as well. Thought it was just me.

Bumping this, happening to me as well.

System details:

  • Home Assistant 2022.11.3
  • Supervisor 2022.10.2
  • Operating System 9.3
  • Frontend 20221108.0 - latest

I can echo a few other comments about this happening while editing horizontal-stack/vertical-stack cards.

1 Like

This also occurred to me since a longer time.
I came to the conclusion it happens if i select some text and try to overwrite them.
It doesnt happened if i deleted the marked text before i typed.
It could be resolved by clicking anywhere else beside the text field and then into the text again.

I thought the problem was solved after version 2022.10 i think, but shortly i have seen it again.

Home Assistant 2022.11.3, Frontend 20221108.0 - latest, Linux, Firefox + Chromium

I have done some testing with my cards now, one time i have seen reversed text (not reproducible).

But i see disappearing lines now and this is reproducible. It may not appear after doing some editing, but it always occurs the first time editing after opening the card code editor.

Grid card with lot of area cards

click card edit ā†’ code editor (one card only)-> double click area name

type: area  
area: config  
navigation_path: config

ā†’ write abc

bctype: area  
navigation_path: config

The area line is deleted, happens also with only one card and in another dashboard,
The same happens with vertical-stack or horizontal-stack instead of grid.

If i mark config and press del, area: doesnt disappear

It also happens on code editor for the entire grid, but only on editing the first card.

square: false
columns: 2
type: grid
cards:
  - type: area  
    area: config  
    navigation_path: config
  - type: area
    area: home
    navigation_path: home

It doesnt happen on a grid with custom:mushroom-entity-cards or mushroom-climate-cards.
It doesnt happen on a grid with GitHub - junalmeida/homeassistant-minimalistic-area-card: A minimalistic area card with sensors and buttons.

I tried this on another HA ( Home Assistant 2022.9.4, Frontend 20220907.2 - latest )

type: area
area: config

after double clicking config and writing one letter becomes

type: area
area: ''

Hourly weather card
click card edit ā†’ click code editor

type: custom:hourly-weather
entity: weather.my_weather_sensor
name: weather
num_segments: '32'
label_spacing: '4'
icons: true

mark my_weather_sensor ā†’ write abc
or place cursor anywhere in weather.my_weather_sensor and try to write or delete any letter

bctype: custom:hourly-weather
name: weather
num_segments: '32'
label_spacing: '4'
icons: true

this also happens if i add an error so there is no card preview
if i mark weather.my_weather_sensor and press del, entity: doesnt disappear

I havenā€™t yet pinpointed how to replicate this, but I am also experiencing it while editing code, and Iā€™m using Firefox 106.0.5 (64-bit) on Ubuntu.

Also seeing this behaviour in macOS Version 13.1 (22C65) with Firefox Developer Edition 109.0b7 (64-bit)

Previous edit was a false positive.

Iā€™ve come up with a way to (almost perfectly) reproduce it, I think.

Iā€™m editing a Mushroom Title Card within a Horizontal Stack Card configuration. Itā€™s empty except for the Title and Subtitle.

  1. Have text in title and subtitle
  2. Select the subtitle field
  3. Select the Title field
  4. Press Command+Left arrow to move the cursor to the beginning
  5. Type and observe the characters entering to the right of the cursor.

I cannot, however, find what attribute is causing this, unfortunately.

Iā€™ve had this on and off since Iā€™ve been using HASS, particularly on Windows PC on Firefox browsersā€¦the way to fix it is to click outside of the text area box and back in againā€¦takes 2 seconds and doesnā€™t affect typing in the box for the remainder of that edit

I get this all the time - also Firefox / Windows 10. Drives me nuts - please someone fix it!