-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Promote top
and left
style keys to config keys in picture elements card configuration
#25049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Promote top
and left
style keys to config keys in picture elements card configuration
#25049
Conversation
"left": "[%key:ui::panel::page-demo::config::arsaboo::names::left%]", | ||
"top": "[%key:ui::panel::lovelace::editor::edit_view_header::settings::badges_position_options::top%]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UX team will have a look at the labels but we shouldn't use completely unrelated ones like these even though they have to desired words
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll create new ones called "Horizontal Position" and "Vertical Position".
{ | ||
name: "left", | ||
selector: { | ||
number: { min: 0, max: 100, unit_of_measurement: "%", step: 0.1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The % unit of measurement is displayed in the number box. Don't know why it is missing in your screenshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized and pushed that in a separate commit after taking the screenshot 😁
left?: number; | ||
top?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should handle this entirely in the editor instead of adding redundant config options. The editor should translate between the style
option and the top/left inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Are you suggesting I put some extra elements in hui-state-icon-element-editor.ts line 121 outside of the <ha-form>
?
Or is there some way of overriding the behavior for specific elements in a form?
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback! Just one question I asked in a comment thread.
{ | ||
name: "left", | ||
selector: { | ||
number: { min: 0, max: 100, unit_of_measurement: "%", step: 0.1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized and pushed that in a separate commit after taking the screenshot 😁
left?: number; | ||
top?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Are you suggesting I put some extra elements in hui-state-icon-element-editor.ts line 121 outside of the <ha-form>
?
Or is there some way of overriding the behavior for specific elements in a form?
"left": "[%key:ui::panel::page-demo::config::arsaboo::names::left%]", | ||
"top": "[%key:ui::panel::lovelace::editor::edit_view_header::settings::badges_position_options::top%]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll create new ones called "Horizontal Position" and "Vertical Position".
Discussed this with the UX team. Here is the summary:
Bottom line, this should have drag & drop but this would not be easy to implement. Input boxes can be acceptable but without sliders and they should handle all cases gracefully (Ex. no inputs if there is no |
Proposed change
Since a picture is worth a thousand words:

The most common way of positioning elements in a picture-elements card is by using the
top
andleft
style keys as%
. It's a pain to line everything up by deleting and re-typing the numbers repeatedly.This improves the situation considerably since browsers allow incrementing/decrementing
<input type=number>
elements using arrow keys, giving pretty much real-time feedback. (I used to open the devtools, adjust the element there and copy paste the number 😁 )I could use some feedback regarding the user-facing strings. I picked "Left" and "Top" because they were already available as localized keys. Should we indicate that these become a percentage? Or maybe just say something along the lines of Horizontal/Vertical position?
Type of change
Example configuration
Here's a simple complete frontend dashboard yaml for the screenshot
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: