Bug 1536264 - Only reset color / background / text-shadow for active options. r=jaws

Otherwise you see font changes when hovering, which is not really desirable.

Differential Revision: https://phabricator.services.mozilla.com/D24116

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-03-21 02:28:24 +00:00
parent 8452fc14bc
commit cdd51a7d35

View File

@ -17,6 +17,13 @@ const MAX_ROWS = 20;
// Minimum elements required to show select search // Minimum elements required to show select search
const SEARCH_MINIMUM_ELEMENTS = 40; const SEARCH_MINIMUM_ELEMENTS = 40;
// The properties that we should respect only when the item is not active.
const PROPERTIES_RESET_WHEN_ACTIVE = [
"color",
"background-color",
"text-shadow",
];
// Make sure to clear these objects when the popup closes to avoid leaking. // Make sure to clear these objects when the popup closes to avoid leaking.
var currentBrowser = null; var currentBrowser = null;
var currentMenulist = null; var currentMenulist = null;
@ -352,8 +359,12 @@ function populateChildren(menulist, options, uniqueOptionStyles, selectedIndex,
for (let property in style) { for (let property in style) {
if (property == "direction" || property == "font-size") if (property == "direction" || property == "font-size")
continue; // handled above continue; // handled above
if (style[property] != selectStyle[property]) { if (style[property] == selectStyle[property])
continue;
if (PROPERTIES_RESET_WHEN_ACTIVE.includes(property)) {
ruleBody += `${property}: ${style[property]};`; ruleBody += `${property}: ${style[property]};`;
} else {
item.style.setProperty(property, style[property]);
} }
} }