Skip to content

MDTextField hint and helper text doesn't update correctly while field is focused #1853

@marluna2

Description

@marluna2

Description of the Bug

When changing MDTextFieldHintText or MDTextFieldHelperText while the text field is focused, the hint or helper text doesn't update at all, or only part of the update animation plays.
I have a quick and dirty workaround for it, but it breaks any potential on_focus functions of the text field,
and the update animation for the helper text also doesn't look very intended.

Code and Logs

from kivy.lang import Builder
from kivymd.app import MDApp

KV = """
MDScreen:
    MDBoxLayout:
        orientation: "vertical"
        md_bg_color: app.theme_cls.surfaceColor
        
        Widget:
        
        MDTextField:
            text: "broken field"
            MDTextFieldHintText:
                text: self.parent.text
            MDTextFieldHelperText:
                text: self.parent.text
                mode: "persistent"
                
        Widget:
        
        MDTextField:
            text: "fixed field"
            on_text: self.focus = False; self.focus = True
            MDTextFieldHintText:
                text: self.parent.text
            MDTextFieldHelperText:
                text: self.parent.text
                mode: "persistent"
                
        Widget:
"""


class Example(MDApp):
    def build(self):
        return Builder.load_string(KV)


Example().run()

Screenshots

Image

Versions

  • OS: Windows 10 Pro
  • Python: 3.10
  • Kivy: 2.3.1
  • KivyMD: 2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions