Skip to content

md-select doesn't expand + md-option text overflow doesn't work properly #2782

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

Closed
fxck opened this issue Jan 24, 2017 · 5 comments
Closed

md-select doesn't expand + md-option text overflow doesn't work properly #2782

fxck opened this issue Jan 24, 2017 · 5 comments
Labels
area: material/select P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@fxck
Copy link
Contributor

fxck commented Jan 24, 2017

using 2.0.0-beta.1-592f33f

since .md-select-value is absolutely positioned, it doesn't expand its parent and is flowing out it

image

also because of display: flex on md-option, ellipsis(three dots) do not work

image

@kara I guess? could try to fix it, but would like to know reasoning behind that absolute position and flex first..

@crisbeto
Copy link
Member

Can't speak about the positioning, but the text ellipsis were fixed recently.

@fxck
Copy link
Contributor Author

fxck commented Jan 24, 2017

were they? I think I'm running the latest version from material2-builds(unless yarn is acting up again)

edit: yep, ellipsis seems to be fixed when I use npm instead, positioning still wrong

@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Jan 24, 2017
@PostImpatica
Copy link

I did the following to allow the text to autoresize:

html

<form>
    <md-select #fixit placeholder="Filter">
        <md-option  *ngFor="let txt of linkCategories$ | async" (onSelect)="change(txt)">
            {{ txt }}
        </md-option>
    </md-select>
</form>

component:

@ViewChild('fixit') fixit: MdSelect;

...

change(txt: string) {
    const font = window.getComputedStyle(this.fixit['_element'].nativeElement, null).getPropertyValue('font');
    let newwidth = 0;
    let canvas = document.createElement("canvas");
    let context = canvas.getContext("2d");
    context.font = font;
    let metrics = context.measureText(txt);
    newwidth = metrics.width + 18;
    this.fixit._selectedValueWidth = newwidth;
    this.fixit._triggerWidth = newwidth;
    // do something with selected txt
}

@crisbeto
Copy link
Member

This should've been resolved a long time ago.

@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 May 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/select P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

6 participants