There is a bug in the Popup component Javascript currently. Popups do not display unless you click the map feature more than once.

I traced this to the following chunk of code in popup.js:

        // If this is a click to the same feature marker it's a close command.
        if (jQuery(container).data('feature-key') == feature[UID_PROPERTY_]) {
          container.style.display = 'none';
          jQuery(container).data('feature-key', '');
          return;
        }

If I comment out that chunk, popups work perfectly.

I'm not exactly sure that the purpose of that code is - but it seems to have something to do with handling the "close popup" event when the X is clicked. But if you look a little farther up in the same file, there is already code for handling that, so closing works fine without the above chunk. Here is the code that handles closing the popup:

      /**
       * Add a click handler to hide the popup.
       * @return {boolean} Don't follow the href.
       */
      closer.onclick = function() {
        container.style.display = 'none';
        closer.blur();
        return false;
      };

Original issue description (from the Farm Map issue queue):

I'm not sure what's causing this, but you can't open the area details popup with a single click.

CommentFileSizeAuthor
#3 openlayers_popup_click-2606054-3.patch729 bytesm.stenta
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Title: Selecting area on map requires multiple clicks » Popup component requires multiple clicks
Project: Farm Map » Openlayers
Issue summary: View changes

I isolated the code that is causing this issue in the Openlayers Popup component. Moving this issue to that project and updating the title and description. Patch coming soon...

m.stenta’s picture

Version: 7.x-1.x-dev » 7.x-3.x-dev
Component: User interface » OL API
Status: Active » Needs review
FileSize
729 bytes

Here is a simple patch that removes the chunk of code causing the issue. I don't think it's necessary.

m.stenta’s picture

Component: OL API » Code
Pol’s picture

Status: Needs review » Fixed

Thanks !

  • Pol committed c032f6c on 7.x-3.x authored by m.stenta
    Issue #2606054 by m.stenta: Popup component requires multiple clicks
    

Status: Fixed » Closed (fixed)

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