ui-select icon indicating copy to clipboard operation
ui-select copied to clipboard

allow-clear with theme=bootstrap broken in 0.9.6

Open zavidovych opened this issue 11 years ago • 28 comments

http://plnkr.co/edit/yzoAL0PRkOyGHeuMbGj2?p=preview

unkjfgzpb8

zavidovych avatar Jan 13 '15 02:01 zavidovych

It does not relate to allow-clear, the bootstrap-layout is broken completely:

http://plnkr.co/edit/2mQ6S7w01mjKhWUMEf6b?p=preview

It was ok in 0.9.2

artkoenig avatar Jan 14 '15 11:01 artkoenig

:+1:

jack-kerouac avatar Jan 19 '15 14:01 jack-kerouac

:+1:

gerardp avatar Jan 20 '15 07:01 gerardp

:+1:

The Demo Plunker linked to from the README.md should be updated to use the latest version of select.css and select.js. Then this issue is immediately obvious there.

  1. Temp workaround for text alignment (probably a better way to fix this):
.ui-select-bootstrap > .ui-select-match > .ui-select-toggle {
    text-align: left;
}
  1. Temp workaround for missing bootstrap styles (box-shadow, etc.): Add css class form-control to button tag on line 2 of match.tpl.html

BP18 avatar Jan 20 '15 23:01 BP18

@BP18 Thanks. I just tried adding your two workaround adjustments for version 0.9.6 and it didn't appear to make any difference in the styling.

abobwhite avatar Jan 21 '15 19:01 abobwhite

It appears that if the allowClear directive is included, there is a conditional ui-select-allow-clear CSS class added that does nothing (no usage in select.js or select.css)...

This is very frustrating.

abobwhite avatar Jan 21 '15 19:01 abobwhite

Hi @abobwhite, I'm not using allow-clear, but my workarounds seem to work on the demo page.

Here's the Demo Plunker as-is other than upgrading to 0.9.6 so I can reproduce the problem: http://plnkr.co/edit/TEt1lqLYSwHo30EQdLvr?p=preview

Here's the same Plunker but with my two fixes added: http://plnkr.co/edit/M1A5BhAK7et987Bhgih3?p=preview

The padding is still messed up, but at least the text-align and other styles are better. Don't think this is really a proper fix, but hopefully it helps figure out what's going on.

BP18 avatar Jan 22 '15 20:01 BP18

@BP18 Thanks.

I'm confused - isn't this issue surrounding the allow-clear styling? allow-clear on both plunkr's yield the same styling issue. If you weren't talking about allow-clear, what styling were you trying to fix, exactly?

abobwhite avatar Jan 22 '15 20:01 abobwhite

@abobwhite, in my first demo Plunker link with just the upgrade to 0.9.6, the Bootstrap theme control is messed up. Without focus on the control, the text is center aligned and the field does not have the other Bootstrap form-control css styles like box-shadow and transition: border-color ease-in-out.

BP18 avatar Jan 22 '15 20:01 BP18

The template did change from

bildschirmfoto 2015-01-22 um 21 41 53

to

bildschirmfoto 2015-01-22 um 21 42 40

could this be the cause?

artkoenig avatar Jan 22 '15 20:01 artkoenig

@artkoenig, yes I think that is where it broke. Commit 6e94894.

Previously the button tag had the form-control css class applied, but with the new template it doesn't. This caused the shadow, transition, and other styles to be lost. The text-align and padding were being controlled by overrides in the select.css file, but that broke with this template change too.

BP18 avatar Jan 22 '15 21:01 BP18

Slightly tweaked my original fixes and submitted a pull request.

BP18 avatar Jan 23 '15 00:01 BP18

I tried to test your changeset, but the 'allow-clear' button is still broken. Is it supposed to be fixed by your changeset ?

gzsombor avatar Jan 23 '15 13:01 gzsombor

That was my understanding as well - it sounds like there are two issues here. Broken bootstrap styles in general as well as broken allow-clear styling for bootstrap. I am most concerned about the allow clear but I'm sure both need to be addressed.

abobwhite avatar Jan 23 '15 14:01 abobwhite

Yes, I think @abobwhite is correct about there being two (related?) issues here. I'm not using allow-clear and neither does the demo page, so my fix didn't address that part.

BP18 avatar Jan 23 '15 15:01 BP18

I played around with allow-clear=true and I see the second problem you are mentioning (the X/clear button appearing below the field instead of integrated). I think my pull request addresses the other styling issues and doesn't make the allow-clear issue worse, so hopefully it can be part of a complete solution.

Also, there was a recent pull request (#486) that was supposed to add allow-clear support to the bootstrap template, but it doesn't work properly.

BP18 avatar Jan 23 '15 18:01 BP18

Thanks for all the hard work already put in, a proper fix would be awesome. tl;dr +1

starf avatar Feb 03 '15 15:02 starf

+1 for this

tarlepp avatar Feb 11 '15 11:02 tarlepp

Meanwhile you can use this little CSS trick:

.ui-select-clear {
    position: relative;
    float: right;
    top: -26px;
    right: 25px;
    border: none;
    background: none;
    margin-bottom: -26px;
}

tarlepp avatar Feb 11 '15 11:02 tarlepp

With https://github.com/angular-ui/ui-select/pull/606 merged, can you confirm if all works ok now?

dimirc avatar Feb 16 '15 02:02 dimirc