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

fix: split button overflow #1975

Merged
merged 7 commits into from
Jan 11, 2021
Merged

fix: split button overflow #1975

merged 7 commits into from
Jan 11, 2021

Conversation

stefanoScalzo
Copy link
Contributor

@stefanoScalzo stefanoScalzo commented Dec 15, 2020

Related Issue

Closes #1721

Description

Add text overflow to the text of split button
For regular cosy button 9.75rem is used because the other button takes 2.25rem and the max-width is always 12rem
For compact 10rem is used to keep this same 12rem max-width

Screenshots

Before:

image

After:

Screen Shot 2020-12-15 at 1 16 52 PM

Please check whether the PR fulfills the following requirements

  1. The output matches the design specs
  • All values are in rem
  • Text elements follow the truncation rules
  • hover state of the element follow design spec
  • focus state of the element follow design spec
  • active state of the element follow design spec
  • selected state of the element follow design spec
  • selected hover state of the element follow design spec
  • pressed state of the element follow design spec
  • Responsiveness rules - the component has modifier classes for all breakpoints
  • Includes Compact/Cosy/Tablet design
  • RTL support
  1. The code follows fundamental-styles code standards and style
  • only one top level fd-* class is used in the file
  • BEM naming convention is used
  • Mixins are used for repeatable code (fd-rtl, fd-ellipsis, fd-flex, fd-selected, fd-focus, ect.)
  • A11y support - keyboard support, screenreader support, proper ARIA attributes, etc.
  • fd-reset() mixin is applied to all elements
  • Variables are used, if some value is used more than twice.
  • Checked if current components can be reused, instead of having new code.
  1. Testing
  • tested Storybook examples with "CSS Resources" normalize option
  • tested Storybook examples with "CSS Resources" unnormalize option
  • Verified all styles in IE11
  • Updated tests
  1. Documentation
  • Storybook documentation has been created/updated
  • Breaking Changes wiki has been updated in case of breaking changes.

@stefanoScalzo stefanoScalzo added this to the Sprint 52 - Hilo milestone Dec 15, 2020
@stefanoScalzo stefanoScalzo requested a review from a team December 15, 2020 18:31
@stefanoScalzo stefanoScalzo self-assigned this Dec 15, 2020
@stefanoScalzo stefanoScalzo changed the title fix: split button overflow [WIP]fix: split button overflow Dec 15, 2020
@netlify
Copy link

netlify bot commented Dec 15, 2020

✔️ Deploy preview for fundamental-styles ready!

🔨 Explore the source changes: 66635b0

🔍 Inspect the deploy logs: https://app.netlify.com/sites/fundamental-styles/deploys/5ffc7a992c16570007cb0ac7

😎 Browse the preview: https://deploy-preview-1975--fundamental-styles.netlify.app

@stefanoScalzo stefanoScalzo changed the title [WIP]fix: split button overflow fix: split button overflow Dec 15, 2020
@JKMarkowski JKMarkowski changed the base branch from master to main December 17, 2020 10:53
@@ -76,4 +76,16 @@ $fd-button-split-margin: 0.125rem / 2;
}
}
}

&__text {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you target the first child instead of adding an additional modifier class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But text is not wrapped in any element, and you cannot really target a TextNode.

Comment on lines 82 to 84
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a mixin for this :D

Copy link
Contributor

@salarenko salarenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the max-width come from? I don't see any requirements in the specs.
Shouldn't standard button component cover such cases?

@stefanoScalzo
Copy link
Contributor Author

Where does the max-width come from? I don't see any requirements in the specs.
Shouldn't standard button component cover such cases?

Screen Shot 2020-12-18 at 9 29 20 AM

@@ -284,7 +284,7 @@ menuButton.parameters = {

export const splitMenuButton = () => `
<div class="fd-button-split fd-has-margin-right-small" role="group" aria-label="button-split">
<button class="fd-button" aria-label="button">Button with text</button>
<button class="fd-button fd-button-split__text" aria-label="button">Button with a lot of text</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just wrap the text inside <span class="fd-button__text">Button with a lot of text</span>?
And inside split-button just add fd-button__text { max-width: ... }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -76,4 +76,15 @@ $fd-button-split-margin: 0.125rem / 2;
}
}
}

.fd-button__text {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanoScalzo Let's add fd-namespace instead of fd-

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@JKMarkowski JKMarkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@InnaAtanasova InnaAtanasova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a Breaking change and should be documented

@@ -76,4 +76,15 @@ $fd-button-split-margin: 0.125rem / 2;
}
}
}

.#{$fd-namespace}-button__text {
@include fd-ellipsis();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this have a reset?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I understand what you did. You don't need the reset coz it's .fd-button__text, but if this is the case, you can't just use it here. Split button is a separate component from Button and this violates the self-contained rule. You will need a modifier class for these rules

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@InnaAtanasova
Copy link
Contributor

Tests are failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

Button - Text Overflow
5 participants