소스 검색

LibWeb: Prevent select.click() opening the dropdown

No other browser allows opening the select element dropdown with the
select.click() function.
This change stops this happening in Ladybird.
Luke Warlow 1 년 전
부모
커밋
564e546ff0
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp

+ 3 - 2
Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp

@@ -431,9 +431,10 @@ WebIDL::ExceptionOr<void> HTMLSelectElement::show_picker()
     return {};
     return {};
 }
 }
 
 
-void HTMLSelectElement::activation_behavior(DOM::Event const&)
+void HTMLSelectElement::activation_behavior(DOM::Event const& event)
 {
 {
-    show_the_picker_if_applicable();
+    if (event.is_trusted())
+        show_the_picker_if_applicable();
 }
 }
 
 
 void HTMLSelectElement::did_select_item(Optional<u32> const& id)
 void HTMLSelectElement::did_select_item(Optional<u32> const& id)