From 245e3b9c3a7d1775cffd1df8101925b582c3b0dc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 18 Mar 2023 20:28:40 +0100 Subject: [PATCH] LibWeb: Honor `pointer-events: none` when hitting a PaintableBox If the PaintableBox had children, but we didn't hit any of them, we default to saying that you hit the PaintableBox itself. However, if said PaintableBox has `pointer-events: none`, we should say nothing was hit, so that the hit testing can continue. This fixes an issue where Discord server icons were not clickable. --- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 43b2d8e41c..21f5df6708 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -688,6 +688,10 @@ Optional PaintableBox::hit_test(CSSPixelPoint position, HitTestTy continue; return result; } + + if (!visible_for_hit_testing()) + return {}; + return HitTestResult { const_cast(*this) }; }