I have made some more observations around this issue I have.

As you have already said, by clicking the Add Markers button, the map
is losing focus and so I need to spoof another click event so the
keyboard navigation re-enables. I have a setMapFocus and setBodyFocus
for controlling what element is in focus on the page.

On an initial page load, with no markers added, you can use the arrow
keys as expected and also hold the Ctrl key down and drag with the
mouse to use the keydragzoom utility. When clicking the Add Markers
button the showPoints function is being called at the end of which
another is a call to the setMapFocus function to spoof a map click
event. This doesn't help my problem whereby after the markers are
added I can no longer use the arrow keys or the Ctrl key drag zoom
feature.

However I have found that I can bring back the key navigation and drag
zoom functionlity on the page through the following scenarios:

1. Click off the map area, e.g. in the white space below, and click
back on the map again
2. Opening an InfoWindow and then closing it using the 'x' button in
the window

Its this initial draw of the units that seems to be causing the
trouble, because although I am using the GEvent.trigger method to try
and spoof a 'click' on the map, this doesnt seem to occuring.

Latest code is at http://www.dev.robparkerdnn.co.uk/

Please help!

Thanks,
Rob

On Apr 27, 2:31 pm, parky128 <[email protected]> wrote:
> Ok I follow what you are saying about having to spoof the map-click.
>
> I have added two functions for enabling and disabling the handler.
>
> I make a call to my enableKeyboardNavigationHandler function at the
> end of the showPoints function but the navigation doesnt work when the
> markers get added to the map.
>
> Also, with regards to your comment that closing the infoWindow causes
> a map click to occur, this isn't the case if you close the infoWindow
> by simply clicking the map again and not clicking the little 'x'
> button in the top right of the infoWindow. Refresh the page, add the
> markers, open a marker infoWindow then click anywhere on the map, not
> the little 'x' button and you will see what I mean!
>
> Sorry to be pain with this one, its been a nuisance to me for some
> time and I am very eager to resolve it.
>
> Cheers,
> Rob
>
> On Apr 27, 2:14 pm, Andrew Leach <[email protected]>
> wrote:
>
>
>
> > On Apr 27, 1:51 pm, parky128 <[email protected]> wrote:
>
> > > Was there supposed to be a link to your example in your most reply?
>
> > No: same link.http://www.acleach.me.uk/gmaps/keyboardhandler.htm
>
> > > Weirdly though, if I hover over a marker to open the info window and
> > > then close that window, the keyboard navigation comes back!
>
> > You click in the map when you close the infoWindow.
>
> > > This is baffling me now.
>
> > Spoof the map-click event to enable the handler; a click outside the
> > map (which my example also spoofs) disables the handler. So when you
> > click a button, you disable the handler. Clicking in the map enables
> > the handler.
>
> > Because clicking the button to add the markers (or remove them)
> > disables the handler, you need to spoof the map-click which re-enables
> > it. That worked for me: entering
> > javascript:GEvent.trigger(document,"click",
> > {srcElement:document.getElementById("myMap"),target:document.getElementById("myMap"),nodeType:
> > 1})
> > in the address bar re-enabled the handler. You could do that in your
> > code when you need it.
>
> > It would probably be a good idea to have two functions, say
> > enableHandler() and disableHandler() which you can call when you need
> > them.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google Maps API" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-maps-api?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Maps API" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/google-maps-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to