Skip to content

extra 'span' element added in mat-option of autocomplete makes impossible to style the internals #8561

Closed

Description

@k-krupka

Bug, feature request, or proposal:

I would consider it a bug unless told otherwise.

What is the expected behavior?

Extra span element is not added, in my opinion - not needed.

What is the current behavior?

Additional element is added to the form, making it impossible to style the internals.
image

What are the steps to reproduce?

  1. http://plnkr.co/edit/dKYBn6NFpMbknwKbVfgP?p=preview
  2. hit F12
  3. hoover over the mat-option

What is the use-case or motivation for changing an existing behavior?

styling of the internals is very hard becuase of the extra span which is added

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

Angular 5.0.0-rc0-40d6bcb
the rest as per plunk example

Is there anything else we should know?

Nope, that's it.

Activity

  1. changed the title [-]span in mat-option of autocomplete makes impossible to style the internals[/-] [+]extra 'span' element added in mat-option of autocomplete makes impossible to style the internals[/+] on Nov 20, 2017
  2. crisbeto commented on Nov 20, 2017

    @crisbeto
    Member

    That span is there to collapse some whitespace, as well as truncate long labels (once #7857 gets in). Note that the text isn't the only content that can be put inside an option, there's also a checkbox that will be shown if the select is in multiple mode.

  3. jelbourn commented on Nov 20, 2017

    @jelbourn
    Contributor

    Closing as "working as intended". You can always target descendants with css

  4. k-krupka commented on Nov 21, 2017

    @k-krupka
    Author

    yep, understood.
    cheers guys!

  5. prashantpimpale93 commented on Jul 4, 2019

    @prashantpimpale93

    @jelbourn I need the option text to appear to the next line after the text overflow from the min-width.

    What I did:

    .mat-autocomplete-panel mat-option.mat-option {
      height: unset;
    }
    
    .mat-option-text.mat-option-text {
      white-space: normal;
    }
    

    But not working!

    Can you suggest something?

  6. angular-automatic-lock-bot commented on Sep 11, 2019

    @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 Sep 11, 2019
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions