🐛 Suppress browser context menu on empty workspace sidebar space (#9196)

Signed-off-by: RenzoMXD <170978465+RenzoMXD@users.noreply.github.com>
Signed-off-by: Renzo <170978465+RenzoMXD@users.noreply.github.com>
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
Renzo 2026-04-29 09:58:38 -06:00 committed by GitHub
parent 22b85f1a92
commit 8821ada1bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 0 deletions

View File

@ -54,6 +54,7 @@
### :bug: Bugs fixed
- Suppress the browser context menu when right-clicking empty space in the workspace sidebars while preserving it on text inputs so paste/select-all still work [Github #5127](https://github.com/penpot/penpot/issues/5127)
- Fix release notes modal appearing behind the dashboard sidebar [Github #8296](https://github.com/penpot/penpot/issues/8296)
- Fix plugin API `fileVersion.restore()` promise hanging indefinitely on restore failure [Github #9092](https://github.com/penpot/penpot/issues/9092)
- Fix imported stroke-only SVG paths losing their rounded join when authoring tools (e.g. Figma → Heroicons) split a continuous polyline into adjacent `M…L M…L` subpaths sharing an endpoint; on import these are now folded back into one chain so `stroke-linejoin` renders the elbow correctly in both editor and exports [Github #5283](https://github.com/penpot/penpot/issues/5283)

View File

@ -42,6 +42,7 @@
[app.main.ui.workspace.sidebar.versions :refer [versions-toolbox*]]
[app.main.ui.workspace.tokens.sidebar :refer [tokens-sidebar-tab*]]
[app.util.debug :as dbg]
[app.util.dom :as dom]
[app.util.i18n :refer [tr]]
[potok.v2.core :as ptk]
[rumext.v2 :as mf]))
@ -183,6 +184,7 @@
:data-testid "left-sidebar"
:data-width (str width)
:class aside-class
:on-context-menu dom/prevent-default-context-menu
:style {:--left-sidebar-width (dm/str width "px")}}
[:> left-header* {:file file
@ -329,6 +331,7 @@
:id "right-sidebar-aside"
:data-testid "right-sidebar"
:data-size (str width)
:on-context-menu dom/prevent-default-context-menu
:style {:--right-sidebar-width (if can-be-expanded?
(dm/str width "px")
(dm/str right-sidebar-default-width "px"))}}

View File

@ -122,6 +122,14 @@
(fn? (.-preventDefault event)))
(.preventDefault event)))
(defn prevent-default-context-menu
[^js event]
(let [target (some-> event .-target)
tag (some-> target .-tagName .toLowerCase)]
(when-not (or (#{"input" "textarea"} tag)
(some-> target .-isContentEditable))
(.preventDefault event))))
(defn get-target
"Extract the target from event instance."
[^js event]