diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index 9fbde31321c..2e7ffd9d8db 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -2425,6 +2425,8 @@ ErrorOr Node::name_or_description(NameOrDescription target, Document con if (labels != nullptr && labels->length() > 0) { StringBuilder builder; for (u32 i = 0; i < labels->length(); i++) { + if (!builder.is_empty()) + builder.append(" "sv); auto nodes = labels->item(i)->children_as_vector(); for (auto const& node : nodes) { // AD-HOC: https://wpt.fyi/results/accname/name/comp_host_language_label.html has “encapsulation” diff --git a/Tests/LibWeb/Text/expected/wpt-import/accname/name/comp_host_language_label.txt b/Tests/LibWeb/Text/expected/wpt-import/accname/name/comp_host_language_label.txt index b84576f7bfc..67a29377e30 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/accname/name/comp_host_language_label.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/accname/name/comp_host_language_label.txt @@ -1,8 +1,8 @@ Harness status: OK -Found 78 tests +Found 79 tests -78 Pass +79 Pass Pass html: input[type=button] Pass html: input[type=image] Pass html: input[type=reset] @@ -80,4 +80,5 @@ Pass html: select encapsulation Pass html: img[alt] (non-empty) Pass html: picture > img[alt] (non-empty) Pass html: fieldset > legend -Pass html: table > caption \ No newline at end of file +Pass html: table > caption +Pass html: multiple label elements[for] \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/accname/name/comp_host_language_label.html b/Tests/LibWeb/Text/input/wpt-import/accname/name/comp_host_language_label.html index 2bb85d9682f..0e71a48d914 100644 --- a/Tests/LibWeb/Text/input/wpt-import/accname/name/comp_host_language_label.html +++ b/Tests/LibWeb/Text/input/wpt-import/accname/name/comp_host_language_label.html @@ -155,6 +155,11 @@ abc 123 + +

HTML input with multiple label/for

+ + +