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
fix(form-field): make outline appearance work in situations where the… #10943
Conversation
… form field is not initially in the DOM
src/lib/form-field/form-field.ts
Outdated
@@ -419,6 +419,9 @@ export class MatFormField extends _MatFormFieldMixinBase | |||
// getBoundingClientRect isn't available on the server. | |||
return; | |||
} | |||
if (!document.contains(this._elementRef.nativeElement)) { |
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.
This one'll probably throw in Universal.
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.
The line above is returning if we're not in the browser
@@ -195,6 +195,8 @@ export class MatFormField extends _MatFormFieldMixinBase | |||
|
|||
_outlineGapStart = 0; | |||
|
|||
_initialGapCalculated = 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.
Rather than adding another property, couldn't we get away with checking that the gap is greater than 0?
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.
Currently that would cause a check loop for other types of form-field, since they set the gap to 0
. I could set it to 1
or some other number in that case since its not really used, but this just seemed clearer
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.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
… form field is not initially in the DOM.
fixes #10498