Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

mdc-text-field blur is triggering focus every time #2280

Open
@msqar

Description

Describe the bug
After debugging the MDC code, noticed that textfield.js has some logic into the onBlur which intentionally triggers focus. Why would this be like that? In my case, I have onFocus functionality that I need to execute, and it's causing me problems.

Here's the snippet:

    onBlur() {
        this._onTouched();
        this._foundation.deactivateFocus();
        this.blur.emit(this.value);
        this._onFocus.emit(false); // <-- this line
    }

Here's my piece of code:

                    <mdc-text-field
                        outlined
                        class="someClass"
                        name="someName"
                        id="someId"
                        (focus)="clearInput(param1, param2)"
                        required
                        >
                    </mdc-text-field>

Expected behavior
Clicking out of input should not trigger on focus. Now, whenever I click out, it's clearing my input. This behaviour i need it to happen only when i intentionally focus in the input by clicking in it, not out.

What Angular MDC version are you using?
"@angular-mdc/web": "^5.1.1",

What OS are you using?:
macOS

What browser(s) is this bug affecting?:
Chrome

Additional context
Add any other context about the problem here.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions