qt_web_browser: Focus on the first link element

Focusing on the first link element fixes element navigation upon loading the web applet in games such as Super Mario Odyssey
This commit is contained in:
jls47 2021-07-17 16:10:15 -07:00 committed by Morph
parent 08350d1744
commit 85e29934fd
3 changed files with 22 additions and 0 deletions

View file

@ -73,6 +73,12 @@ constexpr char LOAD_NX_FONT[] = R"(
})();
)";
constexpr char FOCUS_LINK_ELEMENT_SCRIPT[] = R"(
if (document.getElementsByTagName("a").length > 0) {
document.getElementsByTagName("a")[0].focus();
}
)";
constexpr char GAMEPAD_SCRIPT[] = R"(
window.addEventListener("gamepadconnected", function(e) {
console.log("Gamepad connected at index %d: %s. %d buttons, %d axes.",