Semantic-UI icon indicating copy to clipboard operation
Semantic-UI copied to clipboard

Pull down icon in dropdown shift downward if text is larger than dropdown width.

Open firozansari opened this issue 13 years ago • 7 comments

It disturb the whole aesthetic of the form. Please provide ellipsis with partial text instead in the dropdown.

http://imgur.com/WIjOPo8

firozansari avatar Oct 29 '13 04:10 firozansari

@firozansari can you make a fiddle with the minimal code to reproduce? You can click here, put your code in, and then press Fork to get a new URL.

brigand avatar Oct 29 '13 05:10 brigand

@brigand Here is the code snippet to replicate the issue.

http://jsfiddle.net/S5NHw/

I am just trying to set width of the dropdown. Not sure if I am doing something wrong.

firozansari avatar Oct 29 '13 16:10 firozansari

@firozansari Your best bet is to use whatever size you need to make your text fit. Unless your text could be a dynamic length. If so, then you should just not give it a size.

Here is a fiddle that with a simple over ride can fix the dropdown icon at the size you provided but you can still run into this issue if you start getting smaller. http://jsfiddle.net/hENrP/1/

Correct me if I am wrong guys, but adding ellipsis support or partial text would require some javascript, certainly possible just requires a bit more love to the element.

Unprofound avatar Oct 29 '13 19:10 Unprofound

@firozansari @studiothree10

1) Specify no width - Will automatically resize to whatever size the text is, no need to do anything - http://jsfiddle.net/WhcLh/2/ 2) Specify width manually but wide enough for largest content - http://jsfiddle.net/WhcLh/1/

jlukic avatar Oct 30 '13 14:10 jlukic

@firozansari to add to @jlukic's options:

  1. use a smaller font size for the dropdown; which will allow it to fit
  2. set white-space to nowrap, which prevents the icon/text from wrapping around to the next line
  3. reduce padding on the dropdown

Side note: Semantic is defined in EM, not PX; so if the global font-size of the page changed; a pixel based form would fall apart. You may consider using a grid based form, or using percents.

brigand avatar Oct 30 '13 15:10 brigand

@jlukic @brigand I still believe that providing ellipsis for dropdown is best solution to address item with very large text.

Using smaller font size will again create disharmony with rest of the controls in the form. Reducing padding will solve the problem at some extent but again I have rely on item text for not jeopardizing the form layout.

Best implementation I have seen is on peopleperhour site to address this issue.

Url: http://www.peopleperhour.com/hourlie/new?trffc=topnav_sub_seller Goto form "Earn extra money - offer optional add-on services to the Buyer"

Try extending the text of dropdown on above link through FireBug.

Check this screenshot: http://imgur.com/mHHKzlE

firozansari avatar Oct 30 '13 15:10 firozansari

I achieved the ellipsis for large text using text-overflow.

Here is my modified CSS if someone interested.

.ui.dropdown > .text {
    cursor: pointer;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease 0s;
    white-space: nowrap;
    width: 100px;
}

http://jsfiddle.net/hENrP/2/

firozansari avatar Oct 31 '13 21:10 firozansari