I am using Google's JavaScript Map API with the Location Type Element and have two bugs to report...

Under each location text box are two map areas. Only the bottom one gets populated by a Google Map once the user enters a location, the top one stays unpopulated. In order to hide the unused map areas i had to reference each location field and hide the top map element.

//DRUPAL WRAPPER JQUERY
(function ($, Drupal) {

	//JQUERY DOM READY FUNCTION
	jQuery(document).ready(function($) 
	{
      
		'use strict';
  
		//Emergency No Parking
		$('.webform-location-map:eq(0)').hide();
		$('.webform-location-map:eq(2)').hide();
		$('.webform-location-map:eq(4)').hide();
		$('.webform-location-map:eq(6)').hide();

	});
  
})(jQuery, Drupal);

The second bug is related to the mouse actions for the location field's autocomplete pop up. Using the keyboard to select the address from the autocomplete popup works flawlessly, but the mouse selection is entering random address locations.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

buddym created an issue. See original summary.

jrockowitz’s picture

Status: Active » Postponed (maintainer needs more info)
FileSize
467.11 KB

I am not able to reproduce the issue using the below YAML .

Are you using a custom theme? Can you reproduce the issue on simplytest.me?

location_01:
  '#type': webform_location
  '#title': 'Location 01'
  '#map': true
location_02:
  '#type': webform_location
  '#title': 'Location 02'
  '#map': true

buddym’s picture

I was using a custom theme, Bootstrap 3 CDN.

Here is my YAML code...

first_location:
  '#type': location
  '#title': 'First Location'
  '#map': true
  '#required': true
option_second_location:
  '#type': checkbox
  '#title': 'Optional Second Location'
second_location:
  '#type': location
  '#title': 'Second Location'
  '#states':
    visible:
      ':input[name="option_second_location"]':
        checked: true
  '#map': true
option_third_location:
  '#type': checkbox
  '#title': 'Optional Third Location'
  '#icheck': minimal
third_location:
  '#type': location
  '#title': 'Third Location'
  '#states':
    visible:
      ':input[name="option_third_location"]':
        checked: true
  '#map': true

I tested the above code on simplytest.me and did not get duplicate map elements, but still received unexpected results (i.e. different location) when using my mouse to select from autocomplete options. Also, the second and third maps, both from keyboard and mouse selections did not load properly (remained grey) until I changed the zoom level hit alt key of the browsers (Windows 7 Firefox & IE 11). The test tab feature loaded all three maps consistently.

jrockowitz’s picture

Bootstrap is render the location element's attributes twice. I am not sure why.

jrockowitz’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.36 KB

Good news!!! This is not a Bootstrap issue. Webform Composite elements were being wrapped in fieldset when the should be wrapped in a form element.

Attached patch will most likely cause a regression or two that will need to be fixed.

Status: Needs review » Needs work

The last submitted patch, 5: location_type_element-2896587-5.patch, failed testing. View results

jrockowitz’s picture

Status: Needs work » Needs review
FileSize
4.72 KB

  • jrockowitz committed 7f2e87c on 8.x-5.x
    Issue #2896587 by jrockowitz: Location Type Element
    
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

buddym’s picture

Downloaded and unpacked the latest dev tarball to my site. Removed the folder and files of the existing beta15 build and moved the dev ones under modules. Ran the update script and tested the latest dev build.

It seemed like the Google API wasn't initializing. There were no map elements under my location fields, and when I typed in a location the autocomplete never kicked in. I experienced the same behavior when I switched over to the bartik theme. I didn't see any javascript errors in the console, or php errors in the drupal logs.

Once I reverted back to the beta15 build the maps were back and the autocomplete was again operational.

jrockowitz’s picture

Status: Fixed » Needs review
FileSize
556 bytes

Sorry about that, I forgot to update the javascript selector.

  • jrockowitz committed 5eebd70 on 8.x-5.x
    Issue #2896587 by jrockowitz: Location Type Element
    
jrockowitz’s picture

Since the location element is completely broken, I committed the patch. Please download the latest release to review.

jrockowitz’s picture

Status: Needs review » Fixed
buddym’s picture

Thanks J, it is looking good.

jrockowitz’s picture

Awesome!!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.