Skip to content

Commit

Permalink
[Chips] When deleting text in MDCChipField, only select the last chip…
Browse files Browse the repository at this point in the history
… if the text field is empty.

This change moves the textField length check before the character deletion (previously it happened after), so the last chip in the field is only selected if the user taps the delete key when there is no text entered in the field.

PiperOrigin-RevId: 306522550
  • Loading branch information
bryanoltman authored and material-automation committed Apr 14, 2020
1 parent 2a3a0ad commit 6a6c33b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/Chips/src/MDCChipField.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ - (CGRect)textRectForBounds:(CGRect)bounds {
#pragma mark UIKeyInput

- (void)deleteBackward {
[super deleteBackward];
if (self.text.length == 0) {
[self.deletionDelegate textFieldShouldRespondToDeleteBackward:self];
}
[super deleteBackward];
}

#if MDC_CHIPFIELD_PRIVATE_API_BUG_FIX && \
Expand Down

0 comments on commit 6a6c33b

Please sign in to comment.