File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
src/lib/components/common Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 11<script >
2+ import { onDestroy , onMount } from ' svelte' ;
3+
24 /** @type {Array<{text: string, highlight: boolean}>} */
35 export let logParts = [];
46 export let highlight = false ;
810
911 function expandDetails () {
1012 showDetails = true ;
11- // Restore focus on modal, otherwise it will not be possible to close it using the esc key
13+ restoreModalFocus ();
14+ }
15+
16+ /**
17+ * Restore focus on modal, otherwise it will not be possible to close it using the esc key
18+ */
19+ function restoreModalFocus () {
1220 const modal = document .querySelector (' .modal.show' );
1321 if (modal instanceof HTMLElement ) {
1422 modal .focus ();
1523 }
1624 }
25+
26+ onMount (() => {
27+ restoreModalFocus ();
28+ });
29+
30+ onDestroy (() => {
31+ restoreModalFocus ();
32+ });
1733 </script >
1834
1935<div class =" expandable-log" >
You can’t perform that action at this time.
0 commit comments