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

feat: use visibility instead of display for tooltip #647

Merged
merged 1 commit into from Jul 1, 2018
Merged

feat: use visibility instead of display for tooltip #647

merged 1 commit into from Jul 1, 2018

Conversation

clarfonthey
Copy link

@clarfonthey clarfonthey commented Jul 1, 2018

Visibility can be animated, but display cannot. Because the tooltips already have position: absolute added, ultimately, this has no bearing on the way these tooltips work other than the fact that they can be animated more easily than display. For example, the below makes the tooltip fade in and out:

@keyframes fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.tooltip {
  animation: fade-in 100ms ease-in;
}
.tooltip[aria-hidden="true"] {
  transition: opacity 100ms ease-in, visibility 100s linear;
  opacity: 0;
}
.tooltip[aria-hidden="false"] {
  transition: opacity 100ms ease-in, visibility 0s linear;
  opacity: 1;
}

whereas using display prevents the opacity transition from happening, and the tooltip appears and disappears immediately after the first fade-in animation.

Ultimately, it would be nice to add .show and .hide classes to the tooltips to avoid using [aria-hidden] as a way of identifying the states, but this can be added in a future PR if desired. For now, the main goal is to make everything animateable.

@FezVrasta FezVrasta merged commit fec3de1 into floating-ui:master Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants