-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(select): Fix pristine/dirty error, scope conflict, and many styles. #8672
fix(select): Fix pristine/dirty error, scope conflict, and many styles. #8672
Conversation
@ThomasBurleson @EladBezalel @devversion @crisbeto Can you guys all review this and actually test out the new select demos? Ideally, this would be on a mix of Windows/Mac/iOS/Android/etc. Edit: To clarify, I have tested on Mac Chrome/Safari/Firefox but would like some additional testing for other devices as well as your opinions. |
@topherfangio In general LGTM on Chrome, Edge, Firefox and iOS Safari, however it seems kind of trippy on IE11. Here's what I mean: Note the dropdown in the lower right. It doesn't seem to happen in HEAD. |
var parent = $mdUtil.getClosest(element, 'form'); | ||
var form = parent ? angular.element(parent).controller('form') : null; | ||
|
||
return form ? form.$submitted : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would get rid of form and just do:
return parent ? angular.element(parent).controller('form').$submitted : false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually started with that, but you may not always have a from controller (since this can be used outside of a form) in which case that would throw a NPE. Thus, why I also have a test for this situation 😉
@crisbeto Thanks! I'll see if I can snag an IE11 machine around here somewhere (I think my father-in-law has one) and do some additional testing. Glad you caught that before it went into master 😄 |
Fix styles and code to follow pristine/dirty styling of other input elements and provide CSS class for stand-alone usage. - Select now behaves like a normal input, appearing as invalid if the user focuses/blurs the element, or submits the form, without selecting an option. - Fix issues with floating labels not working on focus. - Add new `md-no-underline` CSS class to allow for stand-alone usage (non-form). - Update demos to show new stand-alone usage with required example. - Standardize asterisk visibility when required when standalone or inside of a `<md-input-container>` Additionally, the select component currently sets the `isOpen` variable on the `$scope`. This can cause conflicts if the user has their own `isOpen` variable on the scope. Fix by privatizing our own variable to `_mdSelectIsOpen` to reduce chances of a conflict. Fixes angular#8529. Fixes angular#7988. Fixes angular#8527.
8691063
to
bc800e2
Compare
@ThomasBurleson I believe this is ready for review/merge now. Let me know if it needs any changes. |
Fix styles and code to follow pristine/dirty styling of other input elements and provide CSS class for stand-alone usage.
if the user focuses/blurs the element, or submits the form,
without selecting an option.
md-no-underline
CSS class to allow for stand-aloneusage (non-form).
example.
or inside of a
<md-input-container>
Additionally, the select component currently sets the
isOpen
variable on the$scope
. This can cause conflicts if the user has their ownisOpen
variable on the scope.Fix by privatizing our own variable to
_mdSelectIsOpen
to reduce chances of a conflict.Fixes #8529. Fixes #7988. Fixes #8527.