diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index fcf17b51dce..25d1be2df92 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -80,6 +80,14 @@ void HTMLAnchorElement::activation_behavior(Web::DOM::Event const& event) if (href().is_empty()) return; + // AD-HOC: Do not activate the element for clicks with the ctrl/cmd modifier present. This lets + // the chrome open the link in a new tab. + if (is(event)) { + auto const& mouse_event = static_cast(event); + if (mouse_event.platform_ctrl_key()) + return; + } + // 2. Let hyperlinkSuffix be null. Optional hyperlink_suffix {}; diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp index d7baffd8efa..0700318c576 100644 --- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp @@ -313,7 +313,9 @@ bool EventHandler::handle_mouseup(CSSPixelPoint viewport_position, CSSPixelPoint auto href = link->href(); auto url = document->parse_url(href); - if (button == UIEvents::MouseButton::Middle) { + if (button == UIEvents::MouseButton::Primary && (modifiers & UIEvents::Mod_PlatformCtrl) != 0) { + m_navigable->page().client().page_did_click_link(url, link->target().to_byte_string(), modifiers); + } else if (button == UIEvents::MouseButton::Middle) { m_navigable->page().client().page_did_middle_click_link(url, link->target().to_byte_string(), modifiers); } else if (button == UIEvents::MouseButton::Secondary) { m_navigable->page().client().page_did_request_link_context_menu(viewport_position, url, link->target().to_byte_string(), modifiers);