Tagged: , ,

Viewing 1 reply thread
  • Author
    Posts
    • #7326
      mattkl
      Participant

      I’ve searched high and low, and could not find any reference to this on the forum. However, I may not have been using the proper phrasing to find what I was looking for.

      I think I found a bug, though I am not sure it is exactly or entirely a Piklist bug. I have been building a contract system for a client. The project includes a large number of add-more sections, sometimes nested, and regular (not add-more) fields. What I discovered is that the add-more fields were not selectable/editable when I tried testing the system on an iPad (either with Safari or Chrome for iOS), but the regular fields worked as expected.

      On a whim, I thought that maybe the issue has to do with the difference between mouse input and touch input. That, combined with the ability to drag add-more elements around prompted me to try disabling the draggable functionality by adding ,'sortable' => false to one of the add-more groups.

      That fixed the problem. Now, the fields in that add-more are selectable/editable. But, the group is no longer draggable/sortable.

      So, that leaves me with a different set of questions and challenges.

      1. Is this really a Piklist bug, or is it something in WordPress, or simply an issue with any iOS or touch-input device?
      2. Is there anything that can be done to allow both the dragging of the add-more sections and editing on iOS?
      3. Could the sortable flag be conditional based on the user’s device (PC vs mobile device)?

      I would rather not turn off the ability to sort the add-more groups entirely.

    • #7327
      mattkl
      Participant

      Ok. I have a (temporary) fix. An ugly fix.

      First, I determine if the user is on a mobile device (the list is not comprehensive) in the PHP above the Piklist field definitions in my metabox file and use that to set a boolean flag…

      $draggable = TRUE;
      		
      if( stristr($_SERVER['HTTP_USER_AGENT'],'ipad') ) {
          $draggable = FALSE;
      } else if( stristr($_SERVER['HTTP_USER_AGENT'],'iphone') || strstr($_SERVER['HTTP_USER_AGENT'],'iphone') ) {
          $draggable = FALSE;
      } else if( stristr($_SERVER['HTTP_USER_AGENT'],'blackberry') ) {
          $draggable = FALSE;
      } else if( stristr($_SERVER['HTTP_USER_AGENT'],'android') ) {
          $draggable = FALSE;
      }
      

      Then, for the add-more definitions, I altered the sortable parameter:
      ,'sortable' => $draggable

      At the moment, this accomplishes the goal of keeping the sortable/dragable functionality for desktop and laptop devices, but disables it and allows for add-more field editing on mobile devices.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.