Skip to content

Allow highlighting multiple elements per step #525

Closed

Description

@jujaysmile

Hi,

I want to attach a step to an element with fixed width & height, this element has a div child (a dropdown content) positioned with the "absolute" css property.

When i configure the attachTo; element: '.parent-element'. the opac layer cover the entire screen, except my element, but the child element is not visible and covered by the opac layer.

Do you have any solution to not cover the parent element and his child ? or a way to specify multiple highlighted elements ?

Thanks

Activity

  1. RobbieTheWagner commented on Aug 20, 2019

    @RobbieTheWagner
    Member

    @jujaysmile I'm not sure I understand, is the child element not inside the parent? If the parent is highlighted, the child should be as well. Can you provide a small example for us to play with?

  2. jujaysmile commented on Aug 20, 2019

    @jujaysmile
    Author

    @rwwagner90 hi, yes, the child element is inside the parent.

    Here is my code

    HTML

    <div class="parent">
      
      <p>Parent (menu button)</p>
    
      <div class="child">
    
        <p>Child (dropdown content)</p>
    
      </div>
    
    </div>
    

    CSS

    .parent {
      position: relative;
      width: 20rem;
      height: 15rem;
      background-color: red;
    }
    
    .child {
      position: absolute;
      bottom: 0;
      left: 0;
      transform: translateY(100%);
      width: 25rem;
      height: 20rem;
      background-color: yellow;
    }
    

    JS

    const tour = new Shepherd.Tour({
      tourName: 'debug-tour',
      useModalOverlay: true,
      defaultStepOptions: {
        classes: 'c-onboarding-modal',
        scrollTo: true,
        scrollToHandler: this.scrollToHandler
      },
      styleVariables: styles,
      disableScroll: true
    });
    
    tour.addStep({
      title: 'Debug',
      text: 'Lorem ipsum...',
      attachTo: {
        element: '.parent', 
        on: 'left'
      }
    });
    
    tour.start();
    

    And here a screenshot

    debug

    Thanks for your help !

  3. RobbieTheWagner commented on Aug 20, 2019

    @RobbieTheWagner
    Member

    @jujaysmile The issue is you are setting a width and height on the parent. We use getBoundingClientRect to get the size of the element and highlight it. You'll have to allow the size to grow to accommodate the child. You could also try setting a super large modalOverlayOpeningPadding to add extra space to the opening, but that's likely not going to work super well.

  4. jujaysmile commented on Aug 20, 2019

    @jujaysmile
    Author

    @rwwagner90 OK, thanks for your answer, I understand the problem. Do you know if there is a way to specify multiple highlighted elements (in this case .parent & .child), i think it will be the perfect solution in this case.

  5. RobbieTheWagner commented on Aug 20, 2019

    @RobbieTheWagner
    Member

    @jujaysmile it's not currently supported. There was an issue opened for it in the past #356

    The problem is if you allowed multiple elements in attachTo how would we know what to attach the tooltip to? We would have to add a new option to add additional highlighted items and create openings for them. Is this something you would like to work on perhaps?

  6. jujaysmile commented on Aug 20, 2019

    @jujaysmile
    Author

    @rwwagner90, ok. I am currently working on a big project and don't have a lot of time right now. But maybe in some times. I am interested by the concept of your tool.

  7. changed the title [-]attachTo element with absolute child[/-] [+]Allow highlighting multiple elements per step[/+] on Aug 22, 2019
  8. RobbieTheWagner commented on Aug 25, 2019

    @RobbieTheWagner
    Member

    @jujaysmile When do you think you might have some time?

  9. stale commented on Sep 24, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  10. 13 remaining items

  11. stale commented on Mar 14, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  12. stale commented on Apr 14, 2020

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  13. RobbieTheWagner commented on Apr 14, 2020

    @RobbieTheWagner
    Member

    @chuckcarpenter would you want to take a stab at this one?

  14. chuckcarpenter commented on Apr 17, 2020

    @chuckcarpenter
    Member

    @Heziode that's a great use case and had us looking in how this could be supported without a big refactor. You can actually use absolute positioning around the colgroup in your table to accomplish this pretty quickly. e.g.,

    image

  15. RobbieTheWagner commented on May 3, 2020

    @RobbieTheWagner
    Member

    @chuckcarpenter should we document your approach here in the cookbook and then close the posibility of highlighting multiple things for now?

  16. akhoury commented on May 4, 2020

    @akhoury

    The colgroup solution wouldn't work on multiple rows? say you have a <tr colspan=x> which represents a section of the following <tr>s, for example

    https://codepen.io/akhoury/pen/KKdZVPm?editors=0011

    edit: I did solve my issue with having multiple <tbody> tags, one for each section, it would still be nice to "add additional highlighted items" as mentioned by @rwwagner90

  17. RobbieTheWagner commented on May 4, 2020

    @RobbieTheWagner
    Member

    @akhoury I believe we were saying you can create a div or some absolute positioned element over the thing you want to highlight, and then you can use that as the target, thus highlighting everything.

  18. akhoury commented on May 4, 2020

    @akhoury

    ah ok, right. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions