ENG-1990: Restore sidebar navigation for blocks containing a smartblock#1199
ENG-1990: Restore sidebar navigation for blocks containing a smartblock#1199sid597 wants to merge 3 commits into
Conversation
Clicks on the rendered block navigate via openTarget unless the click originated on a data-roamjs-smartblock-button element, which passes through to the SmartBlocks extension.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Review follow-up: page refs, tags, block refs, links, inputs and buttons inside the rendered block navigate or act on their own, so the outer click handler double-fired. Navigation now only triggers for clicks on inert content.
|
Review addressed in a466f51. The double-navigation finding was valid — page refs, tags, block refs, links and inputs inside the rendered block act on their own, so the outer handler double-fired. The exclusion is now a selector covering all interactive elements (a, button, input, [data-link-title], [data-tag], .rm-block-ref); button subsumes the SmartBlock trigger. Navigation only fires for clicks on inert content, which keeps the agreed behavior from the ticket. On the overlay alternative: a clickable overlay above the rendered block would intercept the SmartBlock button itself, which is the one thing that must stay clickable, so the exclusion-selector approach was kept. e.defaultPrevented isn't reliable here since Roam's internal handlers don't consistently call preventDefault. |
Pointer events are disabled inside the rendered block and re-enabled only on buttons, so clicks on text, refs, or empty space navigate to the block (never entering edit mode or ref navigation), while smartblock buttons keep running their action.
|
Approach revised in 39520f0 after product clarification: the rendered block is now fully inert except buttons — pointer-events are disabled on everything inside .dg-sidebar-rendered-block and re-enabled only on button elements. Clicking text, refs, tags, or empty space navigates to the block (and can never enter Roam's edit mode or trigger ref navigation, since those clicks no longer reach Roam's elements); clicking a button (e.g. a SmartBlock trigger) only runs its action. This replaces the interactive-element exclusion selector, which is no longer needed beyond the button check on the bubbled click. |
https://www.loom.com/share/f123ad86812345f1a21cb41205d852f6
Sidebar rows rendered via RoamRenderedBlock (blocks containing a SmartBlock button) had no click handler, so clicking the text did nothing. Per the approach agreed on the ticket: a click watcher on the rendered block now navigates via the existing openTarget unless the click originated on a data-roamjs-smartblock-button element, which passes through to the SmartBlocks extension.
Fixes ENG-1990