) [223,10 196x22] overflow: [223,10 196x44]
+ TextPaintable (TextNode<#text>)
+ TextPaintable (TextNode<#text>)
+ PaintableWithLines (BlockContainer
) [433,9 200x24]
+ PaintableWithLines (BlockContainer
) [435,10 196x22]
+ TextPaintable (TextNode<#text>)
diff --git a/Tests/LibWeb/Layout/input/input-placeholder.html b/Tests/LibWeb/Layout/input/input-placeholder.html
new file mode 100644
index 00000000000..73d57d7046a
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/input-placeholder.html
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 318f7239c3a..7d280d358f8 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -601,11 +601,12 @@ void HTMLInputElement::update_placeholder_visibility()
{
if (!m_placeholder_element)
return;
- auto placeholder_text = this->placeholder_value();
- if (placeholder_text.has_value()) {
+ if (this->placeholder_value().has_value()) {
MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "block"sv));
+ MUST(m_inner_text_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "none"sv));
} else {
MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "none"sv));
+ MUST(m_inner_text_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "block"sv));
}
}
@@ -767,7 +768,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
m_placeholder_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
m_placeholder_element->set_use_pseudo_element(CSS::Selector::PseudoElement::Type::Placeholder);
MUST(m_placeholder_element->set_attribute(HTML::AttributeNames::style, R"~~~(
- flex: 1;
+ width: 100%;
height: 1lh;
)~~~"_string));
MUST(element->append_child(*m_placeholder_element));
@@ -779,7 +780,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
m_inner_text_element = MUST(DOM::create_element(document(), HTML::TagNames::div, Namespace::HTML));
MUST(m_inner_text_element->set_attribute(HTML::AttributeNames::style, R"~~~(
- flex: 1;
+ width: 100%;
height: 1lh;
)~~~"_string));
MUST(element->append_child(*m_inner_text_element));
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
index 05ac71e2d51..e9e52217800 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
@@ -398,8 +398,10 @@ void HTMLTextAreaElement::update_placeholder_visibility()
auto placeholder_text = get_attribute(AttributeNames::placeholder);
if (placeholder_text.has_value() && m_text_node->data().is_empty()) {
MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "block"sv));
+ MUST(m_inner_text_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "none"sv));
} else {
MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "none"sv));
+ MUST(m_inner_text_element->style_for_bindings()->set_property(CSS::PropertyID::Display, "block"sv));
}
}