Commit 8f4015c3 authored by Sergey Galich's avatar Sergey Galich
Browse files

Bug 1818969 - Show selected login when navigating with keyboard...

Bug 1818969 - Show selected login when navigating with keyboard r=credential-management-reviewers,mtigley

Differential Revision: https://phabricator.services.mozilla.com/D171030
parent 263e20dd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -842,6 +842,7 @@ export default class LoginList extends HTMLElement {
      from?.classList.remove("keyboard-selected");
      to.classList.add("keyboard-selected");
      to.scrollIntoView({ block: "nearest" });
      this.clickSelected();
    }
  }

+2 −3
Original line number Diff line number Diff line
@@ -144,16 +144,15 @@ add_task(async function test_list_filtered() {
      sendKey(key);
      ok(ol.querySelectorAll(".login-list-item[data-guid]:not([hidden])")[selectedIndex]?.classList?.contains("keyboard-selected"),
        `item ${selectedIndex} should be marked as keyboard-selected`);
      is(ol.querySelector(".selected").dataset.guid, LOGINS[selectedIndex].guid, `item ${selectedIndex} must be selected`);
    }

    pressKeyAndExpectSelection("DOWN", 1);
    pressKeyAndExpectSelection("DOWN", 2);

    // ENTER key in search box must click on selected item in the list
    const selectedGuid = LOGINS[2].guid;
    isnot(ol.querySelector(".selected").dataset.guid, selectedGuid, "item must not be selected");
    sendKey("RETURN");
    is(ol.querySelector(".selected").dataset.guid, selectedGuid, "item must be selected");
    is(ol.querySelector(".selected").dataset.guid, LOGINS[2].guid, "item 2 must still be selected");

    pressKeyAndExpectSelection("DOWN", 2);
    pressKeyAndExpectSelection("UP", 1);