1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

LibWeb: Fire the contextmenu event on right click (if not holding shift)

This now allows websites such as Discord, YouTube and your favourite
"Right Click" xkcd comic to open a custom context menu when you right
click. You can bypass this by holding shift, just like Firefox.
This commit is contained in:
Luke Wilde 2023-05-21 20:29:30 +01:00 committed by Andreas Kling
parent 91d8665ab4
commit e038901555
3 changed files with 22 additions and 18 deletions

View file

@ -77,7 +77,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<MouseEvent>> MouseEvent::create_from_platfo
void MouseEvent::set_event_characteristics()
{
if (type().is_one_of(EventNames::mousedown, EventNames::mousemove, EventNames::mouseout, EventNames::mouseover, EventNames::mouseup, HTML::EventNames::click, EventNames::dblclick)) {
if (type().is_one_of(EventNames::mousedown, EventNames::mousemove, EventNames::mouseout, EventNames::mouseover, EventNames::mouseup, HTML::EventNames::click, EventNames::dblclick, EventNames::contextmenu)) {
set_bubbles(true);
set_cancelable(true);
set_composed(true);