Skip to content

cover popover arrow when title is present #22436

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

Closed

Conversation

IdanCo
Copy link
Contributor

@IdanCo IdanCo commented Apr 13, 2017

Summary

Following issue #22432 and PR #22433 , change the arrow color of popover when title is present -
image

See it in action here - http://jsbin.com/tubuwu/edit?html,output

Before

Arrow color was the same, regardless of the presence or absence of a title in the popover

After

Arrow color is now dependent on the presence or absence of a title in the popover

Technical

I've used an existing pseudo element of the title, originally intended to fix a gap between the popover and the arrow, and redesigned it to cover the arrow entirely with the title's background color.

@Johann-S Johann-S added this to the v4.0.0-beta milestone Apr 13, 2017
@Johann-S Johann-S requested a review from mdo April 13, 2017 14:50
@Johann-S
Copy link
Member

X-Ref : #22433

Copy link
Member

@Johann-S Johann-S left a comment

Choose a reason for hiding this comment

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

@IdanCo IdanCo force-pushed the bugfix/popover-with-title-arrow-color branch from 4655518 to 59cb1f4 Compare April 13, 2017 14:59
@IdanCo
Copy link
Contributor Author

IdanCo commented Apr 13, 2017

Fixed 👍

@IdanCo
Copy link
Contributor Author

IdanCo commented Apr 14, 2017

To be honest, this solution (or the previous one for that matter) is not the best i can think of. No doubt it works, but it lacks the simplicity and cleanness we've come to expect from Bootstrap. I'd like to suggest two alternatives -

1. Use has-title class

Since javascript is already injecting the popover, we can add (here maybe) a single line to toggle between the states -

$tip.toggleClass('has-title', this.getTitle())

And then with a single line of css (instead of the current dozen) set the arrow color:

&.has-title::after {
 border-bottom-color: $popover-title-bg;
}

2. Replace pseudo element with a real element

If the arrow will be an element instead of a psudo-element, it will be possible to use the sibling selector to target the arrow like this -

.popover-title + .popover-arrow::after {
  border-bottom-color: $popover-title-bg;
}

This cannot be done with a pseudo element. I realize pseudo element for arrows were intoduced recently, but since the markup is injected by js anyway, I don't see what is gained by using pseudo element, but this is one example of what is lost.

Thoughts?

@mdo
Copy link
Member

mdo commented Apr 16, 2017

Thanks, but we'll leave it as-is without the extra element or color change. The white arrow is intentional.

@mdo mdo closed this Apr 16, 2017
@IdanCo
Copy link
Contributor Author

IdanCo commented Apr 18, 2017

Sounds good to me, i'll just recommend in that case to remove this rule completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants