Skip to content
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

Incorrect vertical alignment of text inside <ui5-button /> component #3401

Closed
1 of 4 tasks
pavelkornev opened this issue Jun 5, 2021 · 4 comments · Fixed by #3416
Closed
1 of 4 tasks

Incorrect vertical alignment of text inside <ui5-button /> component #3401

pavelkornev opened this issue Jun 5, 2021 · 4 comments · Fixed by #3416
Assignees
Labels
bug This issue is a bug in the code High Prio SAP Graph TOPIC B

Comments

@pavelkornev
Copy link
Member

Bug Description

If page has a custom line-height style and <ui5-button/> component is used among some text nodes, the text inside the button implicitly affected and leads to misalignment vertically (jumps 1-2 pixels up):
Screenshot 2021-06-06 at 01 30 55

Expected Behavior

Outside styles should not affect rendering of inner nodes of button component:
Screenshot 2021-06-06 at 01 32 53

Proposed solution

Add line-height property for button component, e.g.:

<ui5-button icon="add" style="line-height: 100%;">
  Add Comment
</ui5-button>

In our opinion, this property should be included in the implementation of this component rather than in the application code.

Steps to Reproduce

See example below.

Isolated Example

https://codesandbox.io/s/ui5-webcomponents-forked-j0spo?file=/index.html

Context

  • UI5 Web Components version: 1.0.0-rc.14
  • OS/Platform: macOS
  • Browser: Chrome 90.0.4430.212
  • Affected component: <ui5-button />

Priority

  • Low
  • Medium
  • High
  • Very High

Stakeholder Info (if applicable)

  • Organization: SAP Graph
  • Business impact: UX
@ilhan007
Copy link
Member

ilhan007 commented Jun 7, 2021

Hello @SAP/ui5-webcomponents-topic-b we have to ensure that the line-heght set on parent elements does not apply directly on the ui5-button, perhaps setting default one would be best.

ilhan

@ilhan007 ilhan007 added enhancement New feature or request Medium Prio and removed High Prio labels Jun 7, 2021
@ilhan007 ilhan007 added bug This issue is a bug in the code and removed Medium Prio enhancement New feature or request labels Jun 7, 2021
@tsanislavgatev tsanislavgatev self-assigned this Jun 9, 2021
@tsanislavgatev
Copy link
Contributor

Hello @pavelkornev ,

I've opened the example but i see the expected behavior. Can you please check the example, and if we have to add something to reproduce the issue, please update us.

Thanks and Best Regards,
Tsanislav

@ilhan007
Copy link
Member

Hi @pavelkornev I re-checked the codesanbox example above (thanks for providing one)
and keep setting line-height: 32px (48px) to the body (tried on to wrapping div as well) but it applied only over the text somehow - could not see a difference with the Button's text alignment. Could you help me on this?

These are snapshots from your code sandbox example without line-height and with 48px line-height, but could not see a difference in the Button's alignment

no line-height

no_line_height

with 48px line-height

with_48px_lineheight

@pavelkornev
Copy link
Member Author

Hi,
we had a call with Ilhan this morning, here is an updated example: https://codesandbox.io/s/ui5-webcomponents-forked-j0spo?file=/index.html

Screenshot 2021-06-11 at 08 52 42

Top button: has a problem - text is positioned one 1px up.
Bottom button: has a fixed line-height and therefore text is properly centered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code High Prio SAP Graph TOPIC B
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

3 participants