Bug 1463554 - Position the HTML select dropdown exactly on the rich option element.r?MattN
MozReview-Commit-ID: 5Rl3lMczGyh
--- a/browser/components/payments/res/components/rich-select.css
+++ b/browser/components/payments/res/components/rich-select.css
@@ -1,21 +1,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
rich-select {
display: inline-block;
+ position: relative;
+}
+
+/* Focusing on the underlying select element outlines the outer
+rich-select wrapper making it appear like rich-select is focused. */
+rich-select:focus-within {
+ outline: 1px dotted;
}
/*
* The HTML select element is hidden and placed on the rich-option
* element to make it look like clicking on the rich-option element
* in the closed state opens the HTML select dropdown. */
rich-select > select {
opacity: 0;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ margin: 0;
}
.rich-option {
display: grid;
background: #fff; /* TODO: system colors */
padding: 8px;
}
--- a/browser/components/payments/res/components/rich-select.js
+++ b/browser/components/payments/res/components/rich-select.js
@@ -23,17 +23,16 @@ export default class RichSelect extends
constructor() {
super();
this.popupBox = document.createElement("select");
this.popupBox.addEventListener("change", this);
}
connectedCallback() {
- this.tabIndex = 0;
this.appendChild(this.popupBox);
this.render();
}
get selectedOption() {
return this.getOptionByValue(this.value);
}