Open ghost opened 1 year ago
Confirmed Chrome + Win10
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
up
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Seems that this happens due to letter-spacing
attribute inside mdc-button - it creates a kind of "margin" after the last letter of a name.
A possible solution is defining a negative margin-right
to a "span" element containing a name - equal to that letter-spacing
.
May be fixed either on the "material-components-web" side - or on HA side (I hope).
Consider this example:
type: picture-elements
image: /local/images/test/white.jpg
elements:
- type: service-button
title: IIIIIIIII
style:
top: 48%
left: 50%
background-color: rgba(0,255,0,0.2)
service: input_boolean.toggle
service_data:
entity_id: input_boolean.test_boolean
- type: service-button
title: IIIIIIIII
style:
top: 50%
left: 50%
background-color: rgba(0,255,0,0.2)
service: input_boolean.toggle
service_data:
entity_id: input_boolean.test_boolean
card_mod:
style:
ha-call-service-button:
$:
ha-progress-button:
$:
mwc-button:
$: |
button span.slot-container {
margin-right: calc(var(--mdc-typography-button-letter-spacing,.0892857143em) * -1);
}
which creates 2 buttons - default (upper) & fixed (lower):
Zoomed in:
The 2nd button has a properly aligned text.
Note: the var(--mdc-typography-button-letter-spacing,.0892857143em)
value is taken from a letter-spacing
value of mdc-button.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
up
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
up
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Up
Checklist
Describe the issue you are experiencing
When I create a Service Button on a Picture Elements Card and apply a background under the Styles section, the text/title of the Service Button will not correctly center on the background. It seems to be adding a small amount of additional space on the right-hand side.
Describe the behavior you expected
When using the text-align: center parameter under Styles, I would expect the text to perfectly center in the middle of the objects background.
Steps to reproduce the issue
type: picture-elements elements:
![service-button](https://github.com/home-assistant/frontend/assets/86042175/e0f35aaf-2a8f-4b85-aff9-7f18b106e628
You will notice extra pixels/space on the right-hand side. This example is only 1px wide, but this space seems to increase on the iOS mobile app to a noticeable amount.
Perhaps there is something wrong in the css style for the service-button that is causing additional white-space after the last character? I have also tried setting the background-position: center parameter which does not seem to help.
What version of Home Assistant Core has the issue?
core-2023.5.3
What was the last working version of Home Assistant Core?
No response
In which browser are you experiencing the issue with?
MS Edge 113.0.1774.42 (Official build) (64-bit) & iOS Mobile App
Which operating system are you using to run this browser?
Microsoft Windows 11
State of relevant entities
No response
Problem-relevant frontend configuration
Javascript errors shown in your browser console/inspector
No response
Additional information
A second example.
yaml used: