Bug 1567384 Comment 11 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

This is a bug in the one-offs code:

1. The user presses down arrow.
2. The results list sets aria-activedescendant.
3. SearchOneOffs._updateStateForButton gets called with null.
4. _updateStateForButton removes aria-activedescendant, thus overriding 1).

This patch fixes the problem, but you may want to implement this differently:

```
diff --git a/browser/components/search/content/search-one-offs.js b/browser/components/search/content/search-one-offs.js
index 11cefed6a4efb..9484dd4ceae22 100644
--- a/browser/components/search/content/search-one-offs.js
+++ b/browser/components/search/content/search-one-offs.js
@@ -661,7 +661,10 @@ class SearchOneOffs {

     if (this.textbox) {
       if (!button) {
-        this.textbox.removeAttribute("aria-activedescendant");
+        let active = this.textbox.getAttribute("aria-activedescendant");
+        if (active && active.includes("-engine-one-off-item-")) {
+          this.textbox.removeAttribute("aria-activedescendant");
+        }
       } else {
         this.textbox.setAttribute("aria-activedescendant", button.id);
       }
```
This is a bug in the one-offs code:

1. The user presses down arrow.
2. The results list sets aria-activedescendant.
3. SearchOneOffs._updateStateForButton gets called with null.
4. _updateStateForButton removes aria-activedescendant, thus overriding 2).

This patch fixes the problem, but you may want to implement this differently:

```
diff --git a/browser/components/search/content/search-one-offs.js b/browser/components/search/content/search-one-offs.js
index 11cefed6a4efb..9484dd4ceae22 100644
--- a/browser/components/search/content/search-one-offs.js
+++ b/browser/components/search/content/search-one-offs.js
@@ -661,7 +661,10 @@ class SearchOneOffs {

     if (this.textbox) {
       if (!button) {
-        this.textbox.removeAttribute("aria-activedescendant");
+        let active = this.textbox.getAttribute("aria-activedescendant");
+        if (active && active.includes("-engine-one-off-item-")) {
+          this.textbox.removeAttribute("aria-activedescendant");
+        }
       } else {
         this.textbox.setAttribute("aria-activedescendant", button.id);
       }
```

Back to Bug 1567384 Comment 11