-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Popover arrow in bottom-left or bottom-right format isn't centrally aligned to button #5464
Comments
Originally closed as I believe it was something that I had done. After further investigation, it is because I've changed the border-radius of the popover. Should this matter when positioning the arrow? Just because i'd expect it to still be central to the button, with or without border-radius. See plnkr: http://plnkr.co/edit/1gUphx78UA0gLPJXTQgy?p=preview |
The arrow positioning logic is in the $position service here The arrow position is calculated from the edge of the popover element, minus the border radius. The element the popover is attached to is not considered. |
@trippytango, this is designed behavior and unfortunately has the side-effect that you've exposed. The reason why is because if the element on which the popover is attached is, in your case, wider, it wouldn't look weird at all. If I'm reading @RobJacobs' note correctly, I think you could add a right margin to your popover template to force it over. Not ideal, but might make it work in your case. I don't know how this would play in @RobJacobs I do think that this is a valid use case, however, having a tooltip/popover in this manner - i.e., using a help icon. Is there something we can do in this case in the service, or is it too complex of a problem to solve since it would now involve the widths of both the popover and the element to which the popover is attached? |
@icfantv This is the problem we are having, we have it set up as "Auto Bottom". Do you think this behaviour could be refactored to try and incorporate the missing border radius (If the 6px is a default value) so that the value is always correct? |
@trippytango, I'm going to have to defer to @RobJacobs as he's the one who wrote the new |
@icfantv @trippytango The border radius I mentioned is the border radius of the popover style from TWBS which is pulling from the @border-radius-large variable (6px default). This keeps the arrow edge from rendering on top of the rounded popover corner. It has nothing to do with the element that the popover is being positioned against. If you want to center a right aligned popover on the attached element, you will need to accommodate for the @border-radius-large (6px) and 1/2 the @popover-arrow-outer-width (11px). You could potentially add a css class that targets the arrow to make it wide enough to center on that button, but that's no easy feat. I'm not sure how centering the arrow on the attached element would look in other use cases: so I don't think this is something we want to do by default. I followed how Tether was doing their arrow positioning: http://tether.io/docs/welcome/ |
@icfantv @trippytango I did some digging and I think I came up with a way to support setting the arrow placement. This plunk demonstrates using a class to set the arrow margins to center the placement if desired. It will require a code change to remove setting the margin to 0 inline here |
That looks good to me. Two questions:
|
Sorry that i've only just got back to this. So @RobJacobs has a fix but potentially it could have more of an impact in general? If the fix is good to go, when would it be released? |
@trippytango TWBS adds margins to the tooltip arrow as seen here and to the popover arrow as seen here I'll need to do some testing to see what impact not resetting the margins to 0 has. _EDIT_
|
Hi Guys, If I use top-left or top-right, we do not position the arrow to the center of the element. Is that the right behaviour? Using auto does not help. Example here: Check out the bottom table where the mouseenter effect for popover is applied.
will cause issues with auto. |
@shenlong Yes, this is the correct behavior. the corner positions are for the respective edge of the popover/tooltip box. E.g., for |
Hi @icfantv , you have been helpful. In that case, I will use css override for this:
The main properties to change is margin-left and margin-top. Align to your desired center! |
I have a 36 x 36px button and i've set up the popover to be auto bottom. When in a mobile view, i'm expecting the popover arrow to appear central to the button when presented in the bottom-left or bottom-right format.
As you can see in the image below, the arrow isn't appearing centrally when bottom left or bottom right. Is this intended or is there a way to get it to display centrally?
The text was updated successfully, but these errors were encountered: