Skip to content

bug(chips): fixes placeholder in chip inputs #7481 #7509

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

Merged
merged 4 commits into from
Oct 12, 2017

Conversation

amcdnl
Copy link
Contributor

@amcdnl amcdnl commented Oct 3, 2017

This PR resolves #7481 by:

  • Fixes incorrect logic for when placeholder should float
  • Fixes chips from pushing input out of view and not accessible to user

@amcdnl amcdnl self-assigned this Oct 3, 2017
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 3, 2017
@@ -19,6 +19,16 @@ $mat-chip-input-margin: 3px;
align-items: baseline;
}

.mat-form-field-type-mat-chip-list {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be necessary, the user docs are apparently out of date, chips should be done like this now, which resolves the wrapping issues: http://plnkr.co/edit/kc3bxAZRgHS0JbGl3qSX?p=preview

Copy link
Contributor Author

@amcdnl amcdnl Oct 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Here is a PR to update that example too #7526

@@ -240,7 +240,7 @@ export class MatChipList implements MatFormFieldControl<any>, ControlValueAccess
}

get shouldPlaceholderFloat(): boolean {
return this.empty;
return !this.empty;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| this.focused

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mmalerba
Copy link
Contributor

mmalerba commented Oct 4, 2017

Can we also update any examples that still show the old way of doing it?

Edit: oh nvm I see you put that in a separate PR

@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Oct 4, 2017
@kara
Copy link
Contributor

kara commented Oct 5, 2017

@amcdnl Can you check out the CI failures?

@kara kara removed the action: merge The PR is ready for merge by the caretaker label Oct 5, 2017
@amcdnl
Copy link
Contributor Author

amcdnl commented Oct 5, 2017

@kara - done :)

@@ -353,9 +353,9 @@ describe('MatChipList', () => {

});

it('should not float placeholder if no chip is selected', () => {
it('should float placeholder if chip is selected', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was testing when there's a chip present but not selected, so it should still be "... if no chip is selected".

@tinayuangao Why was this expected to be not floating in the first place? It seems like we would want it to float even if the chip isn't selected, to avoid overlap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was invalid, it was expecting the inverse logic that was the bug before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, but it was the "not float" part that was invalid not the "no chip is selected" part

Copy link
Contributor

@tinayuangao tinayuangao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tinayuangao tinayuangao added the action: merge The PR is ready for merge by the caretaker label Oct 11, 2017
@andrewseguin andrewseguin merged commit 3de57fb into angular:master Oct 12, 2017
@amcdnl amcdnl deleted the chips-bug-7481 branch October 16, 2017 13:19
@asmith2306
Copy link

Hi, has this fix made into any of the releases yet? I can't see it in the bug fixes listings for any release. I'm still on "@angular/material": "2.0.0-beta.12", which contains this bug.

Thanks

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chips: placeholder disappears
7 participants