From 47e8e6d3a7ea17b76e5d54a2750f79e91a3513df Mon Sep 17 00:00:00 2001 From: Mats Jun Larsen Date: Fri, 13 Jun 2025 02:43:14 +0900 Subject: [PATCH] Replace href=javascript:; with bootstrap link class (#7797) Fixes #7792 Bootstrap styles `a:has([href])` as a link so the attribute had been used in the past for things that aren't actually links, yet we want the style for. It's better to just use `.link-primary` so it doesn't affect the contents as discovered in #7792 --- static/panes/compiler.ts | 18 +++++++++--------- static/panes/executor.ts | 2 +- static/panes/tool.ts | 2 +- static/widgets/compiler-version-info.ts | 2 +- views/index.pug | 12 ++++++------ views/noscript/compiler.pug | 4 ++-- views/noscript/footer.pug | 2 +- views/noscript/languages.pug | 2 +- views/popups/history.pug | 2 +- views/popups/load-save.pug | 6 +++--- views/templates/widgets/share-item.pug | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/static/panes/compiler.ts b/static/panes/compiler.ts index cc32480af..70bf51c15 100644 --- a/static/panes/compiler.ts +++ b/static/panes/compiler.ts @@ -1792,7 +1792,7 @@ export class Compiler extends MonacoPanehere' + + 'here' + ' to view ' + artifact.title + ' in Speedscope', @@ -1822,7 +1822,7 @@ export class Compiler extends MonacoPanehere' + + 'here' + ' to view ' + artifact.title + ' in Perfetto', @@ -1863,7 +1863,7 @@ export class Compiler extends MonacoPanehere' + + 'here' + ' to emulate', { group: 'emulation', @@ -1895,7 +1895,7 @@ export class Compiler extends MonacoPanehere' + + 'here' + ' to emulate', { group: 'emulation', @@ -1926,7 +1926,7 @@ export class Compiler extends MonacoPanehere to emulate', + 'Click here to emulate', { group: 'emulation', collapseSimilar: true, @@ -1956,7 +1956,7 @@ export class Compiler extends MonacoPanehere to emulate', + 'Click here to emulate', { group: 'emulation', collapseSimilar: true, @@ -1984,7 +1984,7 @@ export class Compiler extends MonacoPanehere to emulate', + 'Click here to emulate', { group: 'emulation', collapseSimilar: true, @@ -2011,8 +2011,8 @@ export class Compiler extends MonacoPanehere to emulate with a debugger, ' + - 'or here to emulate just to play.', + 'Click here to emulate with a debugger, ' + + 'or here to emulate just to play.', { group: 'emulation', collapseSimilar: true, diff --git a/static/panes/executor.ts b/static/panes/executor.ts index 47e3e4eba..d77dbbbff 100644 --- a/static/panes/executor.ts +++ b/static/panes/executor.ts @@ -697,7 +697,7 @@ export class Executor extends Pane { offerViewInSpeedscope(artifact: Artifact): void { this.alertSystem.notify( 'Click ' + - 'here' + + 'here' + ' to view ' + artifact.title + ' in Speedscope', diff --git a/static/panes/tool.ts b/static/panes/tool.ts index 59c0397f8..cb603e8ea 100644 --- a/static/panes/tool.ts +++ b/static/panes/tool.ts @@ -520,7 +520,7 @@ export class Tool extends MonacoPane') - .prop('href', 'javascript:;') + .addClass('link-primary') .html(msg) .on('click', e => { this.eventHub.emit('editorSetDecoration', editorId, lineNum, true, column); diff --git a/static/widgets/compiler-version-info.ts b/static/widgets/compiler-version-info.ts index a58679ee1..bc3ddd7e4 100644 --- a/static/widgets/compiler-version-info.ts +++ b/static/widgets/compiler-version-info.ts @@ -74,8 +74,8 @@ function reallySetCompilerVersionPopover( '
'; const hiddenVersionText = $('
').html(lines).hide(); const clickToExpandContent = $('') - .attr('href', 'javascript:;') .text('Toggle full version output') + .addClass('link-primary') .on('click', () => { versionContent.toggle(); hiddenVersionText.toggle(); diff --git a/views/index.pug b/views/index.pug index 1347ac88d..8dad0dd51 100644 --- a/views/index.pug +++ b/views/index.pug @@ -50,15 +50,15 @@ block prepend content span.fa.fa-info-circle span.hideable.shortlinkInfoText li.nav-item.ui-presentation-control.d-none - a.nav-link.ui-presentation-first(href="javascript:;") + a.nav-link.ui-presentation-first.link-primary span.dropdown-icon.fas.fa-fast-backward | Start li.nav-item.ui-presentation-control.d-none - a.nav-link.ui-presentation-prev(href="javascript:;") + a.nav-link.ui-presentation-prev.link-primary span.dropdown-icon.fas.fa-backward | Previous li.nav-item.ui-presentation-control.d-none - a.nav-link.ui-presentation-next(href="javascript:;") + a.nav-link.ui-presentation-next.link-primary span.dropdown-icon.fas.fa-forward | Next @@ -80,17 +80,17 @@ block prepend content // use `data-bs-toggle="modal"` on the `` itself, as that would prevent the clipboard button from working. // Bootstrap's default blanket event handler beats out any event handler we manually attach to the button. if storageSolution !== "null" - a.dropdown-item#shareShort(href="javascript:;" data-bs-target="#sharelinkdialog" data-bind="Short") + a.dropdown-item.link-primary#shareShort(data-bs-target="#sharelinkdialog" data-bind="Short") span.dropdown-icon.fas.fa-cloud.d-inline | Short Link button.btn.btn-sm.copy-link-btn.clip-icon.float-end(data-bs-target="" data-bs-toggle="none") span.dropdown-icon.fa.fa-clipboard - a.dropdown-item#shareFull(href="javascript:;" data-bs-target="#sharelinkdialog" data-bind="Full") + a.dropdown-item.link-primary#shareFull(data-bs-target="#sharelinkdialog" data-bind="Full") span.dropdown-icon.fas.fa-store-slash.d-inline | Full Link button.btn.btn-sm.copy-link-btn.clip-icon.float-end(data-bs-toggle="none") span.dropdown-icon.fa.fa-clipboard - a.dropdown-item#shareEmbed(href="javascript:;" data-bs-target="#sharelinkdialog" data-bind="Embed") + a.dropdown-item.link-primary#shareEmbed(data-bs-target="#sharelinkdialog" data-bind="Embed") span.dropdown-icon.fas.fa-window-restore.d-inline | Embed in iframe // This is not an oversight, there is in fact a .float-end missing here that's there in the other 2 diff --git a/views/noscript/compiler.pug b/views/noscript/compiler.pug index f011a47dd..00873df52 100644 --- a/views/noscript/compiler.pug +++ b/views/noscript/compiler.pug @@ -6,7 +6,7 @@ block content input#filterAnsi(name='filterAnsi' value='true' type='hidden') .form-pair.inlined.dropdown - a.btn.nodropdown-toggle#outputDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") + a.btn.link-primary.nodropdown-toggle#outputDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") span.fas.fa-cog | Output @@ -14,7 +14,7 @@ block content include ../options-output.pug .form-pair.inlined.dropdown - a.btn.nodropdown-toggle#filtersDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") + a.btn.link-primary.nodropdown-toggle#filtersDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") span.fas.fa-filter | Filters diff --git a/views/noscript/footer.pug b/views/noscript/footer.pug index d1b310eaf..ee62b66d5 100644 --- a/views/noscript/footer.pug +++ b/views/noscript/footer.pug @@ -1,7 +1,7 @@ block footer nav.bg-light if mobileViewer - a.btn.nodropdown-toggle#otherDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Other + a.btn.link-primary.nodropdown-toggle#otherDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Other .noscriptdropdown(aria-labelledby="otherDropdown") include ../menu-other.pug diff --git a/views/noscript/languages.pug b/views/noscript/languages.pug index 731d9024e..7bc95ac4f 100644 --- a/views/noscript/languages.pug +++ b/views/noscript/languages.pug @@ -1,7 +1,7 @@ block header nav.bg-light if mobileViewer - a.btn.nodropdown-toggle#languageDropdown(href="javascript:;" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Language + a.btn.link-primary.nodropdown-toggle#languageDropdown(role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false") Language .noscriptdropdown(aria-labelledby="languageDropdown") each language in languages diff --git a/views/popups/history.pug b/views/popups/history.pug index 68e03ac26..577f4dca9 100644 --- a/views/popups/history.pug +++ b/views/popups/history.pug @@ -12,7 +12,7 @@ ul.historiccode(style="list-style-type: none;") li.template input.preview(type="radio" name="preview" style="margin-right: 10px;") - a(href="javascript:;") + a.link-primary div.src-content#load-history-src-display(style="height:600px;overflow-y:scroll;flex:2") div.monaco-placeholder .modal-footer diff --git a/views/popups/load-save.pug b/views/popups/load-save.pug index 60ea5846a..9d3354594 100644 --- a/views/popups/load-save.pug +++ b/views/popups/load-save.pug @@ -16,12 +16,12 @@ #load-examples.tab-pane.active(role="tabpanel") h4.card-title Load from examples: ul.examples.small-v-scrollable - li.template: a(href="javascript:;") + li.template: a.link-primary #load-browser-local.tab-pane(role="tabpanel") h4.card-title Load from browser-local storage: ul.local-storage.small-v-scrollable li.template - a.me-3(href="javascript:;") + a.me-3.link-primary button.overwrite.btn.btn-sm.btn-light.me-1 span.fa.fa-edit.me-1 | Overwrite @@ -34,7 +34,7 @@ #load-browser-local-history.tab-pane(role="tabpanel") h4.card-title Load from browser-local history: ul.local-history.small-v-scrollable - li.template: a(href="javascript:;") + li.template: a.link-primary #load-file-system.tab-pane(role="tabpanel") h4.card-title Load/save to your system .mb-3 diff --git a/views/templates/widgets/share-item.pug b/views/templates/widgets/share-item.pug index e695c1304..d1ddba415 100644 --- a/views/templates/widgets/share-item.pug +++ b/views/templates/widgets/share-item.pug @@ -1,3 +1,3 @@ #share-item - a.share-item(href="javascript:;" rel="noopener noreferrer" target="_blank") + a.share-item.link-primary(rel="noopener noreferrer" target="_blank") span.share-item-text