Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: static/js/main.js

Issue 29622560: Issue 6040 - Browser select options do not work when you click on their inner text (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Patch Set: Created Nov. 28, 2017, 8:52 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | static/js/vendor/element-closest.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: static/js/main.js
===================================================================
--- a/static/js/main.js
+++ b/static/js/main.js
@@ -323,29 +323,30 @@
document
.querySelector(".article-body")
.insertAdjacentElement("afterbegin", section);
}
BrowserSelect.prototype._onClickOrKeyDown = function(event)
{
- if (!event.target.classList.contains("custom-select-option")) return;
+ var option = event.target.closest(".custom-select-option");
+ if (!option) return;
var IS_ENTER_KEY = event.key == "Enter" || event.keyCode == 13;
if (event.keyCode && !IS_ENTER_KEY) return;
localStorage.removeItem(this.BROWSER_AUTODETECTED_STORAGE_KEY);
// Uncheck previously checked option
this.select
.querySelector("[aria-checked='true']")
.setAttribute("aria-checked", "false");
- this.selectOption(event.target.getAttribute("data-value"));
+ this.selectOption(option.getAttribute("data-value"));
this.close();
};
var browserSelect = document.getElementById("browser-select");
if (browserSelect)
{
new BrowserSelect(browserSelect);
« no previous file with comments | « no previous file | static/js/vendor/element-closest.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld