-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Input: undo change to make inputs same width regardless of prefix/suffix #4789
Comments
@jelbourn Do you have an opinion about setting a default width on the md-input-container? currently we don't and just leave it to the user. However, this means that input's with suffix/prefix wind up a different initial width than ones without by default. (Here's an updated version of the plunker to demonstrate: http://plnkr.co/edit/pXYP1jmV38nHlUWyCJvG?p=preview) |
Are there any disadvantages to setting a default width? Is it the same amount of effort to customize? |
yeah, it should be about the same, they'll just have to make sure their width rule is more specific or comes after our rule (strength will be a single class selector). |
I think this change is a mistake because it makes too big an assumption about the environment. An explicit width should be defined in custom themes or in the user's css, not as a default value. Setting a default width like this is not very responsive, and it's likely to be inconsistent with other components (for example, Select). The components do not all have the same width by default and "about the same" is not much better than "different". The widths for some components also change sometimes, such as required Select fields (with the extra And it makes it necessary to create selectors that are more specific than they need to be, such as I suggest removing the default width from the base stylesheet, providing a guide for setting it in a custom theme and/or in user css, and creating a single built-in opt-in class that defines default widths for all the relevant components. Users can apply the class once to an ancestor (or self) element to apply it "globally". |
Hi @noamkfir could you give me some examples of the kinds of situations where this change causes the input to behave much differently than it used to? It seems to me like it used to just default to I do agree with you about the specificity issue being annoying, if I change it to an element selector rather than class would that be enough to resolve your concerns with setting the default width? |
I just updated material and discovered that all my inputs are now locked to Option 1 (current): everyone is forced to set their own default value somewhere, (eg. Option 2 seems preferable to me. |
+1, this is making our upgrade to beta.10 more difficult. We have input containers inside responsive forms (using fxFlex). So prior to this change, the input containers expanded to available width. Fixed width of 200px is not responsive. We're going to override this with a global width: auto style. |
I didn't realize that change was going to impact people using flex this way. I may just undo this and people can set their own default width if they want. @jelbourn WDYT? |
Seems reasonable to go back to how it was before |
Reopening to track undoing this |
I agree with not assuming that a form field should be set to 200px. It causes issues with flex based layouts. |
Any idea when setting the mat-form-field to a default of 200px will be undone? |
This has been merged now |
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. |
Bug
Enabling the datepicker button changes the width of the input
What is the expected behavior?
The button should not alter the width of the visible input field
What is the current behavior?
The button extends the width of the input field
What are the steps to reproduce?
http://plnkr.co/edit/8Ng4s66r3gw2I0QbINn0?p=preview
What is the use-case or motivation for changing an existing behavior?
All inputs have a uniform width creating a nicely ordered layout. That little width change screws up the the layout.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular/cli: 1.0.2
node: 6.10.0
os: win32 x64
@angular/animations: 4.1.1
@angular/common: 4.1.1
@angular/compiler: 4.1.1
@angular/core: 4.1.1
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.1.1
@angular/http: 4.1.1
@angular/material: 2.0.0-beta.5
@angular/platform-browser: 4.1.1
@angular/platform-browser-dynamic: 4.1.1
@angular/router: 4.1.1
@angular/cli: 1.0.2
@angular/compiler-cli: 4.1.1
The text was updated successfully, but these errors were encountered: