Skip to content

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

Closed

Description

@fxck

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..

Activity

  1. crisbeto commented on Jan 24, 2017

    @crisbeto
    Member

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

  2. fxck commented on Jan 24, 2017

    @fxck
    ContributorAuthor

    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

  3. added
    P3
    on Jan 24, 2017
  4. PostImpatica commented on Feb 3, 2017

    @PostImpatica

    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
    }
    
  5. crisbeto commented on Apr 23, 2021

    @crisbeto
    Member

    This should've been resolved a long time ago.

  6. angular-automatic-lock-bot commented on May 24, 2021

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: material/select

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions