0

There's a web page where I'm trying to use Tampermonkey to give focus to an element in an iframe which is cross-origin to the top document. Copious use of console.log() tells me that my script is executing, getting the proper element, and calling focus() or click() on it, but the component isn't scrolling when I press space; I have to manually click on the element for it to scroll from keyboard input (the page is otherwise responding to keyboard input just fine). I used "inspect" on the element I want and then entered $0 into the console to make sure that I referring to the correct element in my script. I even have my Tampermonkey script use the setTimeout() trick, with a timeout of 1 second, but that's of no help.

A few other things of note:

  • While the page is loading I can scroll up and down using the arrow keys, but as soon as it finishes loading it won't respond to those keys again until I click the element with my mouse.
  • If I click on the element, press Tab to give focus to the next element, then press Shift-Tab to cycle backwards, the result is that there's that thin blue outline around my desired element, seeming to indicate that it has focus, yet pressing space or the arrow keys won't scroll it.

I'm using Chrome 68.0.3440.106

EDIT: The pages in question are rented books from VitalSource viewed with their in-browser book viewer. Unless you already have a book with them that's currently valid you won't be able to view the problem pages.

Matthew Cline
  • 2,312
  • 1
  • 19
  • 36
  • We need a link to the actual page or a [mcve]. – Brock Adams Sep 01 '18 at 06:02
  • @BrockAdams Unfortunately you have to have paid money to be able to access the problem pages. – Matthew Cline Sep 01 '18 at 06:10
  • Well they do have some free offerings, but unless someone wants to fake-up an account just for this (unlikely), you must make an MCVE or pursue an alternative route to a solution. Also, take a look at https://stackoverflow.com/questions/15048223/choosing-and-activating-the-right-controls-on-an-ajax-driven-site – Brock Adams Sep 01 '18 at 06:33

0 Answers0