mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
Gate picker on trusted click (#43485)
Fixes: #43360 This PR makes `<select>` behave like other browsers by only opening the picker for trusted user clicks, and adds a regression test to ensure synthetic `.click()/dispatchEvent('click')` won’t open it. --------- Signed-off-by: SharanRP <z8903830@gmail.com>
This commit is contained in:
@@ -20,6 +20,7 @@ use crate::dom::bindings::codegen::GenericBindings::HTMLOptGroupElementBinding::
|
||||
use crate::dom::activation::Activatable;
|
||||
use crate::dom::attr::Attr;
|
||||
use crate::dom::bindings::cell::{DomRefCell, Ref};
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLOptionElementBinding::HTMLOptionElementMethods;
|
||||
@@ -894,7 +895,11 @@ impl Activatable for HTMLSelectElement {
|
||||
!self.upcast::<Element>().disabled_state()
|
||||
}
|
||||
|
||||
fn activation_behavior(&self, _event: &Event, _target: &EventTarget, _can_gc: CanGc) {
|
||||
fn activation_behavior(&self, event: &Event, _target: &EventTarget, _can_gc: CanGc) {
|
||||
if !event.IsTrusted() {
|
||||
return;
|
||||
}
|
||||
|
||||
self.show_menu();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user