Merge pull request #6301 from vector-im/luke/fix-firefox-wrong-theme

Fix themeing bug with Firefox where "disabled" ignored
This commit is contained in:
Luke Barnard 2018-03-12 17:53:03 +00:00 committed by GitHub
commit 5eae913803
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -313,7 +313,11 @@ async function loadApp() {
if (match) { if (match) {
if (match[1] === theme) { if (match[1] === theme) {
// remove the disabled flag off the stylesheet // remove the disabled flag off the stylesheet
a.removeAttribute("disabled");
// Firefox requires setting the attribute to false, so do
// that instead of removing it. Related:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1281135
a.disabled = false;
// in case the Tinter.tint() in MatrixChat fires before the // in case the Tinter.tint() in MatrixChat fires before the
// CSS has actually loaded (which in practice happens)... // CSS has actually loaded (which in practice happens)...
@ -324,6 +328,11 @@ async function loadApp() {
a.onload = () => { a.onload = () => {
Tinter.setTheme(theme); Tinter.setTheme(theme);
}; };
} else {
// Firefox requires this to not be done via `setAttribute`
// or via HTML.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1281135
a.disabled = true;
} }
} }
} }