File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1941,10 +1941,29 @@ export class SpeechExplorer
19411941 public AddEvents ( ) {
19421942 if ( ! this . eventsAttached ) {
19431943 super . AddEvents ( ) ;
1944+ this . addHtmlEvents ( ) ;
19441945 this . eventsAttached = true ;
19451946 }
19461947 }
19471948
1949+ /**
1950+ * Prevent clicks in mjx-html nodes from propagating, so clicks in
1951+ * HTML input elements or other selectable nodes will stop
1952+ * the explorer from processing the click.
1953+ */
1954+ protected addHtmlEvents ( ) {
1955+ for ( const html of Array . from ( this . node . querySelectorAll ( 'mjx-html' ) ) ) {
1956+ const stop = ( event : Event ) => {
1957+ if ( html . contains ( document . activeElement ) ) {
1958+ event . stopPropagation ( ) ;
1959+ }
1960+ } ;
1961+ html . addEventListener ( 'click' , stop ) ;
1962+ html . addEventListener ( 'keydown' , stop ) ;
1963+ html . addEventListener ( 'dblclick' , stop ) ;
1964+ }
1965+ }
1966+
19481967 /********************************************************************/
19491968 /*
19501969 * Actions and links
You can’t perform that action at this time.
0 commit comments