diff --git a/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
index 123edf60f8a..876e2ca15cc 100644
--- a/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
@@ -38,6 +38,16 @@ void HTMLOptionElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOptionElement);
}
+// FIXME: This needs to be called any time a descendant's text is modified.
+void HTMLOptionElement::update_selection_label()
+{
+ if (selected()) {
+ if (auto* select_element = first_ancestor_of_type()) {
+ select_element->update_inner_text_element({});
+ }
+ }
+}
+
void HTMLOptionElement::attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_)
{
Base::attribute_changed(name, old_value, value, namespace_);
@@ -54,6 +64,8 @@ void HTMLOptionElement::attribute_changed(FlyString const& name, Optional()) {
- select_element->update_inner_text_element({});
- }
- }
+ // Note: this causes attribute_changed() to be called, which will update the