Skip to content

Revert "Revert "feat(material/chips): prevent chips from being delete… #22235

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 3 commits into from
Mar 16, 2021

Conversation

mmalerba
Copy link
Contributor

…d when user holds backspace (#19700)""

This is a roll-forward of the original PR. We will need to resolve the
issues in Google's code base that caused it to be reverted before
merging again.

This reverts commit 4381b8e.

…d when user holds backspace (angular#19700)""

This is a roll-forward of the original PR. We will need to resolve the
issues in Google's code base that caused it to be reverted before
merging again.

This reverts commit 4381b8e.
@mmalerba mmalerba added P2 The issue is important to a large percentage of users, with a workaround action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Mar 15, 2021
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 15, 2021
@mmalerba
Copy link
Contributor Author

@gioragutt FYI

@@ -156,7 +156,9 @@ export class MatChipInput implements MatChipTextControl, AfterContentInit, OnCha
// We focus the last chip on backspace only after the user has released the backspace button,
// And the input is empty (see behaviour in _keyup)
if (event.keyCode === BACKSPACE && this._focusLastChipOnBackspace) {
this._chipGrid._keyManager.setLastCellActive();
if (this._chipGrid._chips.length) {
this._chipGrid._keyManager.setLastCellActive();
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be handled by the GridKeyManager?
Doesn't it have an indication of whether there are items or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it probably should, but we might want to do it as a follow-up PR. This one has already been tested and confirmed to not break anything (other than the one test that's being investigated). I'd like to avoid broadening the scope and potentially causing more failures

Copy link
Contributor

Choose a reason for hiding this comment

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

NP. Let me know if you'd want me to take care of this later.

@mmalerba mmalerba merged commit d11e293 into angular:master Mar 16, 2021
@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 Apr 16, 2021
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 P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants