hterm: fix chromevox pageup/pagedown display

ChromeVox CL crosreview.com/1572523 has changed how
ChromeVox selects nodes and it now selects the
page-up/down role=button nodes directly rather than
selecting the inner text.  This change updates
hterm to expect the correct node to be selected and
make the page-up/down buttons visible on the screen.

Bug: chromium:945698
Change-Id: Ib2f3398f9d18147be3ad0a5396157daf91a6a359
Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/1612866
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Tested-by: Joel Hockey <joelhockey@chromium.org>
diff --git a/hterm/js/hterm_scrollport.js b/hterm/js/hterm_scrollport.js
index 4d701f0..432a034 100644
--- a/hterm/js/hterm_scrollport.js
+++ b/hterm/js/hterm_scrollport.js
@@ -473,11 +473,7 @@
     const accessibilityEnabled = this.accessibilityReader_ &&
         this.accessibilityReader_.accessibilityEnabled;
 
-    const selection = this.document_.getSelection();
-    let selectedElement;
-    if (selection.anchorNode && selection.anchorNode.parentElement) {
-      selectedElement = selection.anchorNode.parentElement;
-    }
+    const selectedElement = this.document_.getSelection().anchorNode;
     if (accessibilityEnabled && selectedElement == this.scrollUpButton_) {
       this.scrollUpButton_.style.top = '0px';
     } else {
diff --git a/hterm/js/hterm_scrollport_tests.js b/hterm/js/hterm_scrollport_tests.js
index d2725f9..6bf28ad 100644
--- a/hterm/js/hterm_scrollport_tests.js
+++ b/hterm/js/hterm_scrollport_tests.js
@@ -257,7 +257,7 @@
 
   selection.removeAllRanges();
   let range = document.createRange();
-  range.selectNodeContents(pageUp.firstChild);
+  range.selectNodeContents(pageUp);
   selection.addRange(range);
   doc.dispatchEvent(new Event('selectionchange'));
 
@@ -269,7 +269,7 @@
 
   selection.removeAllRanges();
   range = document.createRange();
-  range.selectNodeContents(pageDown.firstChild);
+  range.selectNodeContents(pageDown);
   selection.addRange(range);
   doc.dispatchEvent(new Event('selectionchange'));