Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure tooltips are displayed behind modals #22957

Merged
merged 4 commits into from Jul 29, 2022

Conversation

mike-plummer
Copy link
Contributor

User facing changelog

Ensure tooltips for overlaid content do not appear in front of modal dialogs

Additional details

Steps to test

Little bit tricky, but the easiest way to verify this is to get a tooltip to stick open - typically you can throw your mouse around the ACI column headers (Latest Runs & Average Duration) and eventually one will stay open after you've moused off (it'll close if you mouse back over or onto another item with a tooltip).

If you have trouble getting a tooltip to stick open you can try adding :shown="true" to Tooltip.vue around line 12 which should force at least one tooltip open without any interaction.

Once you get a tooltip stuck open, click the "New Spec" button and verify that the tooltip does not overlay the modal or its backdrop.

How has the user experience changed?

Before

Screen Shot 2022-07-27 at 11 09 53 AM

After

Screen Shot 2022-07-27 at 11 09 33 AM

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 27, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Jul 28, 2022



Test summary

4938 0 59 0Flakiness 0


Run details

Project cypress
Status Passed
Commit 8f756c6
Started Jul 29, 2022 1:41 PM
Ended Jul 29, 2022 1:56 PM
Duration 14:57 💡
OS Linux Debian - 11.3
Browser Electron 102

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@mike-plummer mike-plummer marked this pull request as ready for review July 28, 2022 13:39
cy.visitApp()
})

it('should layer beneath modals', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make more sense as a CT test? You could mount a modal and render a tooltip inside it to verify behavior.

// Our modal overlays use a backdrop z-index of 10, but the tooltip lib defaults to 10000 which causes
// tooltips to overlay modals & modal backdrops. Override to set z-index so that tooltips aren't
// forced atop items they shouldn't be
z-index: 9;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have tooltips inside some popovers, which causes the tooltip to not overlay properly. Should this be a prop that gets passed in? We can default to a low z-index and than have an in-modal prop to bump the z-index up. There might be a clever way to detect the context of the tooltip and adjust

Screen Shot 2022-07-28 at 10 06 02 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, missed that in Percy.

I started off trying to use z-index: inherit so the tooltip could infer an appropriate layer based on its parent, but that caused issues with other areas since the tooltips are inherently ad-hoc DOM elements attached to body. I'll poke at it some more to see if there's a clever way to address via CSS

@mike-plummer
Copy link
Contributor Author

Took another tack at this. Since floating-vue uses a fixed z-index we can't easily handle the under- and over-modal use cases without adding a new prop that users would have to provide based on where the tooltip is being used. That didn't seem ideal, so I'm instead trying to address the root issue here which is Tooltips remaining open when they shouldn't. This change has modals close any currently-open tooltips which should prevent the z-index issue from appearing.

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Just hide all the tooltips" seems like a good solution for now.

@@ -133,6 +134,18 @@ fragment LoginModal on Query {
}
`

// Ensure all tooltips are closed when the modal opens - this prevents tooltips from beneath that
// are stuck open being rendered on top of the modal due to the use of a fixed z-index in `floating-vue`
watch(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice, hideAllPoppers is a good find

@ZachJW34 ZachJW34 merged commit 7f054ae into develop Jul 29, 2022
@ZachJW34 ZachJW34 deleted the mikep/22595-tooltip-overlay branch July 29, 2022 15:15
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 2, 2022

Released in 10.4.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.4.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip shows above overlays for login and switching testing type
3 participants