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

No text truncation for multi select dropdown #4343

Open
karanrajpal14 opened this issue Mar 14, 2017 · 6 comments
Open

No text truncation for multi select dropdown #4343

karanrajpal14 opened this issue Mar 14, 2017 · 6 comments
Labels

Comments

@karanrajpal14
Copy link

Description

I'm using the multiselect dropdown and I have quite a few options, close to 11 and most of the times I will have at least 6 selected. When that happens, the text goes under the dropdown arrow and it looks bad.

Repro Steps

Add the following dropdown into a page:

<div class="input-field col s4">
<select multiple>
<option value="" disabled selected>Protocol</option>
<option value="1">HTTP/HTML</option>
<option value="2">Web services/SOAP</option>
<option value="3">Ajax Truclient</option>
<option value="4">Siebel Web</option>
<option value="5">RDP</option>
<option value="6">Oracle NCA</option>
<option value="7">Citrix ICA</option>
<option value="8">Winsocket</option>
<option value="9">SAP GUI</option>
<option value="10">SAP WEB</option>
<option value="11">WAP</option>
</select>
<label>Protocol</label>
</div>

Heres a link to a codepen:
http://codepen.io/anon/pen/PpjrWe

Screenshots / Codepen

Issue:
issue

Fix 1: (Expand the text box dynamically like in selectivity.js)
Homepage link
selectivity

Fix 2: (Show the count of the number of items selected)
Link to demo
all_selected

It would be great if you could give the user an option of using either modes.

Thank you!

@fega
Copy link

fega commented Apr 5, 2017

This is the same issue #633

@Dogfalo, I also agreed with the fact that this kind of behavior looks weird and could be avoided easily.
Will do you maintain your opinion about it?

@DanielRuf
Copy link
Contributor

DanielRuf commented Apr 6, 2017

One possible fix

.select-wrapper input.select-dropdown {
    ...
    padding-right: 10px;
    box-sizing: border-box;
    text-overflow: ellipsis;
}

or

.select-wrapper input.select-dropdown {
    ...
    padding: 0px 10px 0px 0px;
    box-sizing: border-box;
    text-overflow: ellipsis;
}

See http://caniuse.com/#feat=text-overflow and notice also the problems

Does not work in IE8 and IE9 on
Some Samsung-based browsers, have a bug with overflowing text when ellipsis is set and if text-rendering is not auto.
Does not work on select elements work in Chrome and IE, only Firefox.

@fega fega added the bug label Apr 9, 2017
@karanrajpal14
Copy link
Author

@DanielRuf the workaround did work, thank you very much! It will suffice until the issue is fixed. 👍

@DanielRuf
Copy link
Contributor

@fega do we need a PR? Should I prepare one? @tomscholz thoughts against / for this fix?

@alexwbaumann
Copy link

While the suggested text-overflow makes the value display nicer. In my case, it would be more valuable to see all of the options that have been selected. What if the input were changed to a textarea so the value display could show multiple lines?

@TeeMee123
Copy link

TeeMee123 commented Aug 20, 2018

I found a fix. If you add the class truncate to the select element, it turns into a different style which puts a white background to the triangle.
It might have some weird effects though, you have to include options in the parameters for M.FormSelect.init otherwise it has another drop down appear above it.

The fix mentioned earlier using text-overflow didn't work for me testing on chrome.

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

No branches or pull requests

5 participants