ChristopherStephan / IWGI-Speech

3 stars 4 forks source link

Set Focus does not work #36

Closed schlomm closed 10 years ago

schlomm commented 10 years ago

Using the following code mapped on a button works //Set Focus to Search Box function setFocusToSearchBar(){ //jquery-way $("#leaflet-control-geosearch-qry").focus(); //html-way document.getElementById("leaflet-control-geosearch-qry").focus(); } But using the following code with the console or triggering it by using speech, does not work //jquery $("#leaflet-control-geosearch-qry").focus(); //html document.getElementById("leaflet-control-geosearch-qry").focus();

schlomm commented 10 years ago

Works now: https://github.com/ChristopherStephan/IWGI-Speech/blob/master/SpeechAndLeaflet/src/custom/customFunctions.js#L388

The setFocus functions can be called via the console, but please note that you won't see the set focus before you close the console. I've also included some test in the speech commands for Chrome: https://github.com/ChristopherStephan/IWGI-Speech/blob/master/SpeechAndLeaflet/src/speech/webspeech/webspeech_commands.js#L315