File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ export class SpeechExplorer extends AbstractKeyExplorer<string> {
292292 }
293293 if ( this . active ) {
294294 this . Move ( code ) ;
295+ if ( this . triggerLink ( code ) ) return ;
295296 this . stopEvent ( event ) ;
296297 return ;
297298 }
@@ -301,6 +302,24 @@ export class SpeechExplorer extends AbstractKeyExplorer<string> {
301302 }
302303 }
303304
305+ /**
306+ * Programmatically triggers a link if the focused node contains one.
307+ */
308+ protected triggerLink ( code : number ) {
309+ if ( code !== 13 ) {
310+ return false ;
311+ }
312+ let node = this . walker . getFocus ( ) . getNodes ( ) ?. [ 0 ] ;
313+ let focus = node ?.
314+ getAttribute ( 'data-semantic-postfix' ) ?.
315+ match ( / ( ^ | ) l i n k ( $ | ) / ) ;
316+ if ( focus ) {
317+ // Works for CHTML only.
318+ node . parentElement . click ( ) ;
319+ return true ;
320+ }
321+ return false ;
322+ }
304323
305324 /**
306325 * @override
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ declare namespace sre {
2121 }
2222
2323 interface Focus {
24- getNodes ( ) : Node [ ] ;
24+ getNodes ( ) : Element [ ] ;
2525 }
2626
2727 interface Walker {
You can’t perform that action at this time.
0 commit comments