@@ -247,12 +247,14 @@ version="3.0">
247247
248248 <!-- mousedown in a region: Shift extends the standing selection to the
249249 clicked point (the anchor never moves - preventDefault stops the
250- native caret placement that would collapse it), a plain primary press
251- arms a sweep anchor for the mousemove takeover (no preventDefault:
252- native caret placement and in-host drags proceed untouched). SaxonJS
253- dispatches an event at the innermost matching template only, so a
254- press on the drag handle never reaches this (the handle owns its
255- gesture) and chrome is guarded out explicitly -->
250+ native caret placement that would collapse it), a press on non-editable
251+ canvas places the caret at the point itself (no native placement exists
252+ there), and a plain primary press on a host arms a sweep anchor for the
253+ mousemove takeover (no preventDefault: native caret placement and
254+ in-host drags proceed untouched). SaxonJS dispatches an event at the
255+ innermost matching template only, so a press on the drag handle never
256+ reaches this (the handle owns its gesture) and chrome is guarded out
257+ explicitly -->
256258 <xsl : template match =" *[contains-token(@class, 'rdfa-editor-content')]" mode =" ixsl:onmousedown" >
257259 <xsl : variable name =" event" select =" ixsl:event()" />
258260 <xsl : variable name =" region" as =" element()" select =" ." />
@@ -282,6 +284,32 @@ version="3.0">
282284 <ixsl : set-property name =" sweepAnchorHost" select =" ()" object =" rdfae:editor-state()" />
283285 <ixsl : set-property name =" sweepRegion" select =" rdfae:root-of($anchor-node)" object =" rdfae:editor-state()" />
284286 </xsl : when >
287+ <!-- a press that landed outside every editable host: the surface
288+ between blocks, the handle gutter, a structural container's own
289+ box. The browser has no caret to place there and no focusable
290+ element below the region to focus, so the placement is ours -
291+ the nearest host takes focus and the caret lands at the point,
292+ rather than focus dropping off the canvas. A point that resolves
293+ into a non-editable parent (rdfae:caret-at-point escapes islands
294+ and chrome to a position beside them) has no host to focus and
295+ nothing to place: it falls through to the region's own tabindex -->
296+ <xsl : when test =" empty($target/ancestor-or-self::*[@contenteditable = 'true'])
297+ and exists(rdfae:host-of($point?node))" >
298+ <xsl : sequence select =" ixsl:call($event, 'preventDefault', [])[current-date() lt xs:date('2000-01-01')]" />
299+ <xsl : call-template name =" rdfae:focus-caret" >
300+ <xsl : with-param name =" node" select =" $point?node" />
301+ <xsl : with-param name =" offset" select =" $point?offset" />
302+ </xsl : call-template >
303+ <!-- the preventDefault killed the native drag session, so a sweep
304+ dragged out of here is synthetic throughout (no anchor host) -->
305+ <ixsl : set-property name =" sweepAnchorNode" select =" $point?node" object =" rdfae:editor-state()" />
306+ <ixsl : set-property name =" sweepAnchorOffset" select =" $point?offset" object =" rdfae:editor-state()" />
307+ <ixsl : set-property name =" sweepAnchorHost" select =" ()" object =" rdfae:editor-state()" />
308+ <ixsl : set-property name =" sweepRegion" select =" $region" object =" rdfae:editor-state()" />
309+ <!-- focusin only fires when the host changes; a point in the same
310+ host still moves the caret, so sync from the choke point -->
311+ <xsl : call-template name =" rdfae:update-breadcrumb" />
312+ </xsl : when >
285313 <xsl : otherwise >
286314 <xsl : for-each select =" $point" >
287315 <ixsl : set-property name =" sweepAnchorNode" select =" ?node" object =" rdfae:editor-state()" />
0 commit comments