Bug 1463554 - Position the HTML select dropdown exactly on the rich option element.r?MattN draft
authorprathiksha <prathikshaprasadsuman@gmail.com>
Fri, 06 Jul 2018 12:30:09 -0700
changeset 818496 3d0d2e040b734df81c79c5b61cf3df0ac93836f5
parent 818495 82045022d4e13971d85f8c48a539a8e195b5d88c
child 819453 c1526655ebd0fae710809b761294fbd7f6ad2659
push id116274
push userbmo:prathikshaprasadsuman@gmail.com
push dateSat, 14 Jul 2018 06:06:00 +0000
reviewersMattN
bugs1463554
milestone63.0a1
Bug 1463554 - Position the HTML select dropdown exactly on the rich option element.r?MattN MozReview-Commit-ID: 5Rl3lMczGyh
browser/components/payments/res/components/rich-select.css
browser/components/payments/res/components/rich-select.js
--- 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);
   }