LibWeb: Hide inner text of input element when showing placeholder

This commit is contained in:
Bastiaan van der Plaat 2024-03-15 18:22:57 +01:00 committed by Tim Flynn
parent b4bae912c9
commit 4205ac778f
Notes: sideshowbarker 2024-07-17 02:21:14 +09:00
4 changed files with 68 additions and 4 deletions

View file

@ -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));
}
}