components icon indicating copy to clipboard operation
components copied to clipboard

Input components (md-input, md-select, md-checkbox etc) aren't aligned in a flex container...

Open jmcgoldrick opened this issue 9 years ago • 59 comments

... without setting align-items: center

Updated Plunk: http://plnkr.co/edit/TgFy04UErh9Xhr0A4XzK?p=preview

md-input behaves differently to md-select (and at least md-checkbox, possibly all the other "input" components) when the elements are within a "flex container"

See this plunk for an example: http://plnkr.co/edit/aLXsp8MlV2AoOkC9aEFP?p=preview

This issue might be resolved with the in-progress refactor of input?

jmcgoldrick avatar Dec 09 '16 01:12 jmcgoldrick

it's been 6 hours ago.... I have to update my npm

dreweird avatar Dec 09 '16 02:12 dreweird

Thanks for reporting! The various form components should definitely align. We'll need to figure out which baseline to standardize under. cc: @jelbourn.

kara avatar Dec 09 '16 03:12 kara

I recognized that also the spacing between the selected/input text and the label is different for md-select and md-input. The screenshot below shows a md-input and a md-select with the spacing im referring to. I would really appreciate, if they would use the same spacing to improve homogeneity of the forms. Since I think, this aspect is related to the topic of this issue, I didn't open a new one.

spacing

On https://material.io/guidelines/components/text-fields.html#text-fields-labels there are two definitions for that kind of spacing under Labels -> Specs. Actually, it seems to be that md-select implements the left one with 8dp space between label and text and md-input implements the right one with 4dp spacing.

DSoko2 avatar Jan 06 '17 13:01 DSoko2

Hi,

This is a bit off topic, but why not using md-input-container for md-select ? It would be great to have a single entry point. Maybe this is stupid question and not possible at all due to constraints, but to me this looks more logic.

This could also be used to group radio button or checkbox in order to define a placeholder which looks exactly like md-input placeholder.

Thanks

no-more avatar Feb 02 '17 04:02 no-more

Thank you for all this wonderful code. I am busy refactoring a ton of Bootstrap.

On this mention of a common wrapper, I have been wishing for md-prefix and md-hint support across all of the form controls. For inputs I have enjoyed using md-prefix with md-icon together -- for example a search icon.

sumpton avatar Feb 02 '17 06:02 sumpton

This might be related: besides the header not having the same height from the text ... the initial overall height is not the same.
The standard input looks like it has the height of 50px and the select box is 30px.
so after you fill in something there is no space between the top like the standard input image

tmburnell avatar Feb 07 '17 13:02 tmburnell

Here is another example: image

This uses material beta 2, and flex-layout beta 5

tmburnell avatar Feb 23 '17 16:02 tmburnell

@jmcgoldrick do you mind update your plunker to make it work so i can investigate it further?

EladBezalel avatar Mar 05 '17 23:03 EladBezalel

@EladBezalel see here: http://plnkr.co/edit/TgFy04UErh9Xhr0A4XzK?p=preview I've updated with some toggles for the common issues I have come across:

  • Placeholder alignment
  • Alignment in a flex-box
  • Issues with font-size

Oh, and some bits to highlight some of the elements if it helps

jmcgoldrick avatar Mar 06 '17 04:03 jmcgoldrick

What's the status on fixing this issue? If there has been any work done has it also fixed this issue #3192?

JacobBrandt avatar Mar 17 '17 03:03 JacobBrandt

Sorry to ping you @jelbourn but I just want someone to let the community know what's going on with this issue. Is anyone working it? How close are they to a solution?

Now, I know things happen and bugs are inevitable but these visual discrepancies are a real turn off that shouldn't be neglected for this long (now almost 4 months). I hope to hear that the team is working on all the visual inconsistencies and unexpected behaviors that are currently present within the basic form components (checkbox, radio, slide-toggle, select).

Also, what is the dpi you use to convert the dp measurements in the material design spec? It doesn't seem like it's 160dpi. I ask because if you need help fixing these I'd be willing to help out, just need to know the conversion you all use.

Thanks!

JacobBrandt avatar Mar 20 '17 22:03 JacobBrandt

@EladBezalel is taking a look into this. We definitely know this is an issue (as it was in AngularJS Material) and we're trying to make sure the approach we take is the right one.

jelbourn avatar Mar 20 '17 22:03 jelbourn

It is a quite important bug for UI component :| Hope to be fixed soon in a consistent way.

essenov avatar Mar 22 '17 23:03 essenov

Any status update on this?

raxkaynan avatar Mar 31 '17 10:03 raxkaynan

show stopper for me at the moment capture

atul221282 avatar Apr 08 '17 15:04 atul221282

This shouldn't be a show stopper for anyone. It's not very hard to add custom CSS to get these elements to align temporarily until they are fixed.

Splaktar avatar Apr 12 '17 21:04 Splaktar

I know that but alignment works differently on different browsers it may work differently on mobile browsers.

atul221282 avatar Apr 12 '17 21:04 atul221282

For placeholders misalignment one fix works for me using custom css: .mat-select-placeholder.mat-floating-placeholder {transform: scale(.75) translateY(7px) !important;} 2017-04-19_14-34-52 Only one problem remains unresolved. When you click on the selector, the placeholder jumps for a second (since the value of transform is set using the script and is reset to the desired once browser remember "!import" and to fix it you have to pick the code of the component, which absolutely i don't want to be done). Maybe someone has better solution?

Sunsvision avatar Apr 19 '17 11:04 Sunsvision

Maybe this is a silly suggestion, but could the heights / offsets be an '@Input()' ?

jdell64 avatar May 04 '17 23:05 jdell64

@jdell64, that's not what @Inputs are really used for. You wouldn't want heights/offsets to be configurable (in a template) like colors or disableds are, for example. It might lead to a style inconsistent with Material.

LOZORD avatar May 05 '17 01:05 LOZORD