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

Improve slide-toggle text label #5212

Closed
ocarreterom opened this issue Jun 19, 2017 · 6 comments · Fixed by #9166
Closed

Improve slide-toggle text label #5212

ocarreterom opened this issue Jun 19, 2017 · 6 comments · Fixed by #9166
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions

Comments

@ocarreterom
Copy link
Contributor

Bug, feature request, or proposal:

Proposal

What is the expected behavior?

The text of the slide-toggle should wrap or be ellipsed like md-checkbox.

What is the current behavior?

The label push de content out of its parent.

What are the steps to reproduce?

Demo: http://plnkr.co/edit/MZ3fzeJKCyBvGIBphl2P?p=preview

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

angular/material: 2.0.0-beta.6-0aaeb69

Is there anything else we should know?

¿Remove white-space: nowrap?

@devversion
Copy link
Member

I think there was a reason why we didn't do that. I will try to figure out why.

@devversion devversion self-assigned this Jun 19, 2017
@jelbourn jelbourn added the P4 A relatively minor issue that is not relevant to core functions label Jun 20, 2017
@devversion
Copy link
Member

The reason I didn't add the text ellipsis to the slide-toggle was that the label of the slide-toggle does have a dynamic width (and therefore the ellipsis couldn't work properly)

There are workarounds for flexbox containers to properly show a text ellipsis.

.mat-slide-toggle-label {
  flex: 1;

  * {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@jelbourn Do you think we should do something like that? I feel like it's not good to reach out of the components view (with the CSS selector)

@jelbourn jelbourn added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Jun 26, 2017
@jelbourn
Copy link
Member

Why does it have a dynamic width?

@devversion
Copy link
Member

Because the slide-toggle adjusts its with depending on the content (specified from the user)

This seems to be an issue with FlexBox elements (while it works with inline block for example)

@benelliott
Copy link
Contributor

benelliott commented Nov 13, 2017

Seems that as of PR #6674 this is the intended behaviour for both mat-checkbox and mat-slide-toggle. Is there an "official" way to enable text wrapping or ellipsising for these components other than overriding the CSS to remove white-space: nowrap?

devversion added a commit to devversion/material2 that referenced this issue Dec 29, 2017
* Instead of showing the text overflow of slide-toggle content, an ellipsis for too long labels will be shown.

Fixes angular#5212
jelbourn pushed a commit that referenced this issue Jan 21, 2018
* Instead of showing the text overflow of slide-toggle content, an ellipsis for too long labels will be shown.

Fixes #5212
jelbourn pushed a commit that referenced this issue Jan 23, 2018
* Instead of showing the text overflow of slide-toggle content, an ellipsis for too long labels will be shown.

Fixes #5212
jelbourn pushed a commit to jelbourn/components that referenced this issue Jan 29, 2018
* Instead of showing the text overflow of slide-toggle content, an ellipsis for too long labels will be shown.

Fixes angular#5212
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants