]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🐛 Use buttons for Termynal controls (#16132)
authorSebastián Ramírez <tiangolo@gmail.com>
Mon, 3 Aug 2026 20:16:46 +0000 (22:16 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Aug 2026 20:16:46 +0000 (22:16 +0200)
docs/en/docs/css/termynal.css
docs/en/docs/js/termynal.js

index a2564e2860a4b423dd9f5aead6123ac61c5571f4..daa6038a0a8a386d6315b541c501a9a2abddc650 100644 (file)
     text-align: center;
 }
 
-a[data-terminal-control] {
+button[data-terminal-control] {
+    cursor: pointer;
     text-align: right;
     display: block;
+    width: 100%;
     color: #aebbff;
+    border: 0;
+    background: transparent;
+    font: inherit;
+}
+
+button[data-terminal-control]:hover {
+    color: var(--color-text);
 }
 
 [data-ty] {
index 82d04e2d0b1b3025e86fb0692ebe2eefb9b1c2a9..057c1efe9671b0d1d1f0ad660b2d5615576fcf63 100644 (file)
@@ -127,27 +127,29 @@ class Termynal {
     }
 
     generateRestart() {
-        const restart = document.createElement('a')
-        restart.onclick = (e) => {
-            e.preventDefault()
+        const restart = document.createElement('button')
+        restart.type = 'button'
+
+        restart.onclick = () => {
             this.container.innerHTML = ''
             this.init()
         }
-        restart.href = "javascript:void(0)"
+
         restart.setAttribute('data-terminal-control', '')
         restart.innerHTML = "restart ↻"
         return restart
     }
 
     generateFinish() {
-        const finish = document.createElement('a')
-        finish.onclick = (e) => {
-            e.preventDefault()
+        const finish = document.createElement('button')
+        finish.type = 'button'
+
+        finish.onclick = () => {
             this.lineDelay = 0
             this.typeDelay = 0
             this.startDelay = 0
         }
-        finish.href = "javascript:void(0)"
+
         finish.setAttribute('data-terminal-control', '')
         finish.innerHTML = "fast →"
         this.finishElement = finish