diff --git a/Tests/LibWeb/Text/expected/HTML/HTMLProgressElement-set-attributes.txt b/Tests/LibWeb/Text/expected/HTML/HTMLProgressElement-set-attributes.txt
index 6af4a53740e..902e15e68c5 100644
--- a/Tests/LibWeb/Text/expected/HTML/HTMLProgressElement-set-attributes.txt
+++ b/Tests/LibWeb/Text/expected/HTML/HTMLProgressElement-set-attributes.txt
@@ -2,6 +2,7 @@ value attribute initial value: 0
max attribute initial value: 1
value attribute after setting value attribute to -1: 0
max attribute after setting max attribute to -1: 1
+max attribute after setting max attribute to 0: 1
value attribute after setting value attribute to 50: 1
value attribute after setting max attribute to 100: 50
max attribute after setting max attribute to 100: 100
diff --git a/Tests/LibWeb/Text/input/HTML/HTMLProgressElement-set-attributes.html b/Tests/LibWeb/Text/input/HTML/HTMLProgressElement-set-attributes.html
index 98905b0d2f0..60da7461602 100644
--- a/Tests/LibWeb/Text/input/HTML/HTMLProgressElement-set-attributes.html
+++ b/Tests/LibWeb/Text/input/HTML/HTMLProgressElement-set-attributes.html
@@ -9,6 +9,8 @@
println(`value attribute after setting value attribute to -1: ${progressElement.value}`);
progressElement.max = -1;
println(`max attribute after setting max attribute to -1: ${progressElement.max}`);
+ progressElement.max = 0;
+ println(`max attribute after setting max attribute to 0: ${progressElement.max}`);
progressElement.value = 50;
println(`value attribute after setting value attribute to 50: ${progressElement.value}`);
progressElement.max = 100;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
index e4f1ce5bfa2..8ecfac9c7fa 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
@@ -64,7 +64,8 @@ double HTMLProgressElement::max() const
{
if (auto max_string = get_attribute(HTML::AttributeNames::max); max_string.has_value()) {
if (auto max = parse_floating_point_number(*max_string); max.has_value())
- return AK::max(*max, 0);
+ if (*max > 0)
+ return *max;
}
return 1;
}