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

[BUG] Pagination button for basic table shows text that is cut off at the bottom #1486

Open
FriedhelmWS opened this issue Feb 5, 2025 · 3 comments
Labels
bug Something isn't working untriaged

Comments

@FriedhelmWS
Copy link

FriedhelmWS commented Feb 5, 2025

Describe the bug

A few pixels appear to be cut off from the bottom of the pagination button (empty button), as shown in the screenshots. This issue doesn't appear to occur with empty buttons that are used alone.

To Reproduce
Steps to reproduce the behavior:

  1. Go to any page that contains a basic table component
  2. See the issue

Expected behavior

No cut off

Screenshots

Image

In OSD:

Image

In OUI documentation (not very obvious due to background):

Image

Host/Environment:

  • OUI Version: 2.0
  • OSD Version (if applicable): 2.18
  • OS: IOS
  • Browser and version Chrome 132

Additional context

Causes

In _button_empty.scss:

.ouiButtonEmpty {
@include ouiButton;

border-color: transparent;
background-color: transparent;
box-shadow: none;
// sass-lint:disable-block no-important
transform: none !important; /* 1 */
animation: none !important; /* 1 */
transition-timing-function: ease-in; /* 2 */
transition-duration: $ouiAnimSpeedFast; /* 2 */
line-height: inherit; // here

.ouiButtonEmpty__content {
  padding: 0 $ouiSizeS;
}

.ouiButtonEmpty__text {
  text-overflow: ellipsis;
  overflow: hidden;
}

The line-height: inherit; property causes the button text to inherit a line-height: 1; from ouiBody, which doesn't provide enough height to fully display characters with descenders, such as 'g' and 'y'.

Image

Suggested Fix

.ouiButtonEmpty__text {
  text-overflow: ellipsis;
  overflow: hidden;
  line-height: normal;
}

Add line-height: normal; to the button text only so that the line height is auto-adjusted by the browser (roughly 1.2 according to the docs), without changing the inherited behavior of the parent button styles.

@FriedhelmWS FriedhelmWS added bug Something isn't working untriaged labels Feb 5, 2025
@ruanyl
Copy link
Member

ruanyl commented Feb 12, 2025

@FriedhelmWS I found the original request that introduced the change #1342, it seems it fixed another styling issue, changing it to normal might result in regression.

@FriedhelmWS
Copy link
Author

FriedhelmWS commented Feb 12, 2025

@FriedhelmWS I found the original request that introduced the change #1342, it seems it fixed another styling issue, changing it to normal might result in regression.

@ruanyl Yes, I noticed the original line-height: inherit; was there for a purpose. So I think we can keep this line-height: inherit; but add line-height: normal; to .ouiButtonEmpty__text, which is the child element to the element that originally has line-height: inherit; property.

I think if we do so, the original behavior of the button baseline alignment (which is intended) would not be affected, but can also fix the issue of the button text. This do require some more checking for regression though.

@ruanyl
Copy link
Member

ruanyl commented Feb 12, 2025

@FriedhelmWS Adding line-height: normal; to .ouiButtonEmpty__text seems causing regression. After investigation, I feel adding line-height: inherit; to .ouiButtonEmpty might not be a good idea, because that causes the button to inherit line height from its parent, for example:

<div style={{lineHeight: 100}}>
  <OuiButtonEmpty />
</div>

This button will have line height 100px which is unexpected I believe. The button line-height should only be decided by the button size itself.

I think we should remove line-height: inherit; and make .ouiButtonEmpty__text to be display: flex to fix the issue.

ruanyl added a commit to ruanyl/oui that referenced this issue Feb 13, 2025
Removed `line-height: inherit` introduced by opensearch-project#1342 and use `display:
flex` to fix the original issue.

With this commit, it also fixed the issue described in opensearch-project#1486

Signed-off-by: Yulong Ruan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
Development

No branches or pull requests

2 participants