Skip to content

Commit b6a50ec

Browse files
buck54321chappjc
authored andcommitted
explorer: fix darkmode on firefox
Firefox appears not to propagate click and hover events on disabled buttons, so this works around it.
1 parent c5f9d26 commit b6a50ec

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

public/js/controllers/menu_controller.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ function closest (el, id) {
1414

1515
export default class extends Controller {
1616
static get targets () {
17-
return ['toggle', 'darkModeToggle']
17+
return ['toggle', 'darkModeToggle', 'form']
1818
}
1919

2020
connect () {
2121
this.clickout = this._clickout.bind(this)
22-
document.querySelectorAll('.menu-submit').forEach(button => { button.disabled = true })
22+
this.formTargets.forEach(form => {
23+
form.addEventListener('submit', e => {
24+
e.preventDefault()
25+
return false
26+
})
27+
})
2328
}
2429

2530
_clickout (e) {

public/scss/navigation.scss

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ body.darkBG {
167167
}
168168
}
169169

170+
.menu-form:hover .menu-item {
171+
color: #2e75ff;
172+
}
173+
170174
.menu-submit {
171175
border: none;
172176
text-decoration: none;

public/scss/themes.scss

+4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ body.darkBG {
142142
}
143143
}
144144

145+
#menu .menu-form:hover .menu-item {
146+
color: $dark-link-hover-color;
147+
}
148+
145149
#menu {
146150
background: #2a2a2a;
147151
box-shadow: 0 0 0 1px #fff3;

views/extras.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@
111111
{{- else}}
112112
<a class="menu-item" data-keynav-skip href="{{.Links.Mainnet}}" title="Home">Switch To Mainnet</a>
113113
{{- end}}
114-
<form action="/set" method="post">
114+
<form action="/set" method="post" data-target="menu.form" class="menu-form">
115115
<input type="hidden" name="darkmode" value="darkmode">
116116
<input type="hidden" name="requestURI" value="{{.RequestURI}}">
117-
<button type="submit"
117+
<button type="submit" data-action="click->menu#onSunClick"
118118
class="menu-submit text-left w-100 p-0"
119119
data-keynav-skip>
120-
<div class="menu-item" data-action="click->menu#onSunClick">
120+
<div class="menu-item">
121121
<span id="sun-icon" class="dcricon-sun-fill no-underline pr-2"></span>
122122
Night Mode
123123
</div>

0 commit comments

Comments
 (0)