Material-components-ios: [TextFields] .editingChanged not fired on clear button.

Created on 27 Mar 2018  路  1Comment  路  Source: material-components/material-components-ios

MDCTextField doesn't fire UIControlEvents.editingChanged when user tapped its clear button while UITextField does.

// UITextField
textField.addTarget(self, action: #selector(onTextFieldEditingChanged(_:)), for: .editingChanged)

// MDCTextField
materialTextField.addTarget(self, action: #selector(onTextFieldEditingChanged(_:)), for: .editingChanged)

@objc
func onTextFieldEditingChanged(_ textField: UITextField) {
    debugPrint(textField.text ?? "")
}

We can confirm this difference simply with the code below.

I think this behavior should be adjusted.

[TextFields] UITextField Bug

Most helpful comment

Yes it is very important to have an event for the clear button in situations where we are validating users' entry while they are typing (e.g. to Enable/Disable the login button)
Currently, we have to remove clear button in those cases which is not a solution.

>All comments

Yes it is very important to have an event for the clear button in situations where we are validating users' entry while they are typing (e.g. to Enable/Disable the login button)
Currently, we have to remove clear button in those cases which is not a solution.

Was this page helpful?
0 / 5 - 0 ratings