diff --git a/src/wtforms/fields/core.py b/src/wtforms/fields/core.py
index ce862dc39..194eec3a5 100644
--- a/src/wtforms/fields/core.py
+++ b/src/wtforms/fields/core.py
@@ -818,7 +818,7 @@ class FloatField(Field):
is ignored and will not be accepted as a value.
"""
- widget = widgets.TextInput()
+ widget = widgets.NumberInput(step="any")
def __init__(self, label=None, validators=None, **kwargs):
super().__init__(label, validators, **kwargs)
diff --git a/tests/fields/test_float.py b/tests/fields/test_float.py
index b7d21fdc7..23a2ea4e5 100644
--- a/tests/fields/test_float.py
+++ b/tests/fields/test_float.py
@@ -13,9 +13,11 @@ def test_float_field():
form = F(DummyPostData(a=["v"], b=["-15.0"]))
assert form.a.data is None
assert form.a.raw_data == ["v"]
- assert form.a() == """"""
+ assert form.a() == """"""
assert form.b.data == -15.0
- assert form.b() == """"""
+ assert (
+ form.b() == """"""
+ )
assert not form.a.validate(form)
assert form.b.validate(form)
form = F(DummyPostData(a=[], b=[""]))