Skip to content

bug(mat-form-field): updateOutlineGap does not recalculate when label is changed to be empty #23943

Closed

Description

@ko-tori

Description

Some logic in updateOutlineGap skips recalculation when the label content is falsy. This prevents the outlineGap from updating when the label is cleared. It seems like the same logic also prevents the outline gap from updating when the label is removed altogether. In these cases, instead of just returning, the outline should be restored to default.

Reproduction

https://stackblitz.com/edit/angular-nmdjyj

Steps to reproduce:

  1. Have a form-field with appearance="outline" and a mat-label
  2. After loading and outline gap is calculated, set the contents of the mat-label to ""

Expected Behavior

Focusing the form-field should show no outline gap

Actual Behavior

Focusing the form-field should shows an outline gap

Environment

  • Angular:
  • CDK/Material:
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Activity

  1. added
    needs triage
    on Nov 10, 2021
  2. self-assigned this
    on Nov 11, 2021
  3. added
    P3
    and removed
    needs triage
    on Nov 11, 2021
  4. added a commit that references this issue on Nov 11, 2021
    bfc8944
  5. added 2 commits that reference this issue on Jan 18, 2022
    805eee8
    d3123f9
  6. angular-automatic-lock-bot commented on Feb 18, 2022

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Feb 18, 2022
  8. added a commit that references this issue on Apr 3, 2022
    31dfe81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3area: material/form-field

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions