13 November 2019
YouTube focus fix script update
A new release of the Tampermonkey/Greasemonkey script "YouTube focus fix" is available: Version 0.4.
It fixes a problem that prevented the script from working in the latest Chrome versions. No new features are present. It is recommended to update to the new version of the script to ensure that it keeps working properly.
A few days ago, I noticed that the script is no longer working in Chrome, but it still works in Firefox. I debugged the problem and found out the following things:
- YouTube indicates a valueless
tabindexon its movie player.
- A valueless
tabindexhas the value of an empty string
- The HTML5.1 standard mandates that "
The tabindex attribute, if specified, must have a value that is a valid integer". In this case, the tabindex attribute is specified but with an empty value.
- The HTML5.1 standard goes on to define what happens when this requirement is violated or the
- A new update in Chrome seems to have changed the browser's vaguely defined behaviour.
- Due to this issue, I am forced to handle this special case in my script and accommodate all the vaguely behaving browsers with a workaround.
- The workaround is to define a special focus function that first sets the
tabindexto a valid number, calls
focus()and then resets the
tabindexto whatever it was before.
- The web hasn't changed all that much since its early years after all. It is a pipe dream to think that if your code works in one browser, it works in all of them. It is probably a pipe dream to think that your code works, period.
(no comments yet)