Skip to content

Conversation

@Bakual
Copy link
Contributor

@Bakual Bakual commented Oct 27, 2015

Inspired by #8150
This PR uses the Bootstrap "popover" method to display a tooltip when there is a title and description present in a form.
To test, you can have a look at an article edit form. The "Title" field doesn't have a description, thus a regular tooltip is shown. The alias does have both, thus the popover will be used.

In backend this worked fine for me. In frontend, the placement was looking bad because it goes that far right. Not sure why it behaves different there.
I tried with position it on top, but then it got cut in backend for the alias, so that isn't ideal either. And I think it actually looks better when placed right there.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Bakual can you use

else
{

here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no clue what you talk about 😊

@infograf768
Copy link
Member

NIce and simple but works only for labels, not the other tooltips. Indeed an issue in frontend where not only does it show far away from the label (defeating the purpose of the tip and totally invisible on small screens, see picture) but also one can have multiple type of tips on the same page:
Edit an article: "Category" will show the old way and the other tips the new way.

screen shot 2015-10-27 at 11 15 40

Note: concerning #8150, it needs more care as it also concerns Hathor, Protostar and Beez.
Please let me know if I go on working on it or not.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

We had the same alignment issue with our tooltips, which was fixed with #5137. I have now included the same fix for popovers as well.
Alignment should be fine now.

And yes, it only affects forms as this is the place where I expected a title/content combination. This should be B/C as long as the template supports popovers, which a good template should support anyway.
Other places would have to be fixed in the extension itself.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

As for the failing unit tests, I don't understand those enough to fix them. I thought I had found it, but apparently not 😊

@infograf768
Copy link
Member

@Bakual
This is not RTL aware: text direction as well as tip placement.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

This is not RTL aware: text direction as well as tip placement.

Good find. That seems to be unrelated to this PR. I have found two places in core where we already use popovers and it doesn't work nice with RTL there as well:

  • Smart Search main view (index). If you hover over the calendar icon.
  • Module Manager when you create a new module, hover over the description text of the module.

We should fix it in all places and I would prefer that to be done in another PR if possible.

@infograf768
Copy link
Member

@Bakual
I have a solution for rtl (if this PR is desired). modified code based on your PR.
This for Isis, but same can be done for the other core templates.

diff --git a/layouts/joomla/form/renderlabel.php b/layouts/joomla/form/renderlabel.php
index 0520c9f..48f3079 100644
--- a/layouts/joomla/form/renderlabel.php
+++ b/layouts/joomla/form/renderlabel.php
@@ -34,7 +34,24 @@
 if (!empty($desc))
 {
-   JHtml::_('bootstrap.tooltip');
-   $classes[] = 'hasTooltip';
-   $title     = ' title="' . JHtml::tooltipText(trim($text, ':'), $desc, 0) . '"';
+   if ($text && $text != $desc)
+   {
+       JHtml::_('bootstrap.popover');
+       $classes[] = 'hasPopover';
+       $title     = ' title="' . htmlspecialchars(trim($text, ':')) . '"'
+           . ' data-content="'. htmlspecialchars($desc) . '"';
+
+       if (JFactory::getLanguage()->isRtl())
+       {
+           if ($position == '')
+           {
+               $position = ' data-placement="left" ';
+           }
+       }
+   }
+   else
+   {
+       JHtml::_('bootstrap.tooltip');
+       $classes[] = 'hasTooltip';
+       $title     = ' title="' . JHtml::tooltipText(trim($text, ':'), $desc, 0) . '"';
+   }
 }
diff --git a/administrator/templates/isis/less/template-rtl.less b/administrator/templates/isis/less/template-rtl.less
index 2dd8f68..8e081de 100644
--- a/administrator/templates/isis/less/template-rtl.less
+++ b/administrator/templates/isis/less/template-rtl.less
@@ -247,2 +247,7 @@
    }
 }
+
+/* Correcting popover text-direction */
+.popover {
+   text-align: right;
+}
\ No newline at end of file
diff --git a/administrator/templates/isis/css/template-rtl.css b/administrator/templates/isis/css/template-rtl.css
index 3b7bfbb..55f7a7e 100644
--- a/administrator/templates/isis/css/template-rtl.css
+++ b/administrator/templates/isis/css/template-rtl.css
@@ -1672,4 +1672,5 @@
    padding-left: 180px;
 }
+.control-label .hasPopover,
 .control-label .hasTooltip {
    display: inline-block;
@@ -8925,2 +8926,5 @@
    }
 }
+.popover {
+   text-align: right;
+}

Note: as stated in the other PR, this needs CSS changes in every template. So I wonder about B/C.

@infograf768
Copy link
Member

We will get:
screen shot 2015-10-27 at 15 38 30

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

I think we could add the RTL CSS rule to this (tooltip) block: https://github.com/joomla/joomla-cms/blob/staging/media/jui/less/bootstrap-rtl.less#L582-L585
Looks like it's where we fixed the tooltips, so any templates which are built using that LESS file should get the fix.

The data-placement will work for most cases I think. What I like about the default value is that I think it automatically changes the placement if there is no room to show it. Like if there is no room on the right, it will go down or so. But have to test that.

@infograf768
Copy link
Member

As far as I know, only Isis is using bootstrap-rtl.less

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

Protostar loads the compiled bootstrap-rtl.css file while Isis compiles its own template-rtl.css which includes the bootstrap-rtl.less file.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

Updated to take care of RTL languages.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

Popovers don't look nice for Hathor, but they are already used in the modul manager. So that would have to be fixed anyway.
Same for Beez, doesn't look nice. That's a shortcoming of this template and will also be true for any 3rd party extension that uses Popovers. It's a shame we ship core templates which don't support all features the core has. If someone wants to propose supporting CSS, I'm all ears 😄

@mbabker
Copy link
Contributor

mbabker commented Oct 27, 2015

The problem with both of those templates is they aren't natively Bootstrap designed. In the case of Hathor specifically it has bits and pieces of Bootstrap hacked into it but the template was never fully Bootstrap capable.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 27, 2015

Yeah, I know that. And thus it fails on any Bootstrap feature we actually have APIs within the CMS to use. It's a bad example we do here.

@dgrammatiko
Copy link
Contributor

I have tested this item ✅ successfully on e0af65c

Isis only


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@infograf768
Copy link
Member

I confirm:

Hathor tooltips (label) broken.
screen shot 2015-10-28 at 08 40 21

Beez tooltips broken
screen shot 2015-10-28 at 08 45 10

I first thought the solution could have been to create a specific layout for these 2 templates so that popovers are not implemented but it may be a better idea to do the opposite, i.e. not change the core layout but, instead, add the patched layout in Isis and Protostar. The advantage of that is that it would be totally B/C.
What do you think?

Concerning the Modules Select page, we have a bug in RTL.
it should be:

<?php else : ?>
    <li>
        <small class="hasPopover" data-placement="left" 

instead of

<?php else : ?>
    <li>
        <small rel="popover" data-placement="left"

I will make a specific PR as this concerns present staging.
EDIT: Hmm, the popover disapears when we reduce the window size.
I tried to use instead using data-placement="top" there but I get a weird arrow...
screen shot 2015-10-28 at 09 41 49

Anyhow this would also require a css change to get text-align: right;

@Bakual
Copy link
Contributor Author

Bakual commented Oct 28, 2015

We could do a template override just for Isis and Protostar and be totally B/C.
On the other hand, the templates which will have issues with popovers, already have those issues with any extension which uses them.
Since popovers are actually a feature of our core (we have an API to create them!) I'm more favoured in changing the core output.
Yes it may affect templates which aren't supporting everything they should (read: bad templates), but I don't think it's that big of an issue. It will only affect tooltips of a form.
Imho, it would even be a good thing as it forces templates to support popovers better.
We may have to add basic instructions to our doc pages with basic CSS to support popover (and tooltips). Basically include the rules from popover.less 😄

@joomla-cms-bot
Copy link

This PR has received new commits.

CC: @DGT41


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@Bakual
Copy link
Contributor Author

Bakual commented Oct 28, 2015

@infograf768 Works now also for Isis and Hathor. As a side effect, the "New Module" view in the Hathor module manager now has working popovers as well.

I leave it to others to decide if we want to do that only for our core templates (using JLayout overrides) or change it in core.

@infograf768
Copy link
Member

What about the Modules Select page? I did not make a PR because

EDIT: Hmm, the popover disapears when we reduce the window size.
I tried to use instead using data-placement="top" there but I get a weird arrow...

@Bakual
Copy link
Contributor Author

Bakual commented Oct 28, 2015

That would be an exsting bug anyway since that view already uses popovers in Isis. The same happens there as well. I'm not sure if it needs to be fixed though. It's not like it's that important :)

@infograf768
Copy link
Member

The issue is clearly the use of data-placement="top" or "bottom" which makes bootstrap popover arrow failing.
Is it a known bug ? Can we solve it ourselves?

@Bakual
Copy link
Contributor Author

Bakual commented Oct 28, 2015

Hmm, looks fine in Chrome and IE for me when trying both with placement top and bottom. Looks like a bug in your browser then?
How does the popver look for the Alias field in the article edit form? That one would be placed on bottom as well.

@infograf768
Copy link
Member

the arrow issue happens only in RTL.
screen shot 2015-10-28 at 16 11 36

@mikeveeckmans
Copy link

I have tested this item ✅ successfully on 009fc69

TEST OK


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@gunjanpatel
Copy link
Contributor

Hello @Bakual "This branch has conflicts that must be resolved"


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@rahultailored
Copy link

Hello @Bakual,

I have tried to apply patch but it doesn't successful. I think it is because Merge Conflicts like @gunjanpatel said.

Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@joomla-cms-bot
Copy link

This PR has received new commits.

CC: @DGT41, @iljabos, @mikeveeckmans


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@Bakual
Copy link
Contributor Author

Bakual commented Jul 1, 2016

@gunjanpatel @rahultailored Branch is rebased with current staging now and conflict in hathor/css/template.css is solved. Should be fine again.

@kalpeshtailored
Copy link

I have checked Article edit pages in mobile view and desktop view, and found only category field tool-tip and another fields tool-tips just want to know that, Is it an issue ?

screen shot 2016-07-01 at 07 57 05screen shot 2016-07-01 at 07 57 11


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@Bakual
Copy link
Contributor Author

Bakual commented Jul 1, 2016

The "Category" field tooltip doesn't has a title, just the "category" text (quite useless actually). Thus it shows as a regular tooltip (white font on black ground).
The "Tags" field has a title and a description as the tooltip and thus it uses the new popover (black font on white ground).

The other fields below (Version Note, Author's Alias, Status, Featured, ...) all also should have a "popover"-style tooltip.

@kalpeshtailored
Copy link

I have tested this item 🔴 unsuccessfully on bfda664


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@Bakual
Copy link
Contributor Author

Bakual commented Jul 1, 2016

@kalpesh681 Can you be more specific about your enviroment? Because when I try to reproduce the issue with Chrome (faking a Galaxy S5) it seems to work fine. I also don't see a reason why it shouldn't work for specifc fields. The code is always the same.

@kalpeshtailored
Copy link

@Bakual I checked in Firefox 47.0 and screen size 320 X480 (faking an IPhone 4) size.

@kalpeshtailored
Copy link

I checked in latest staging CMS testing successfully, now not able to see issue, Thank you for update me.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@Bakual
Copy link
Contributor Author

Bakual commented Jul 8, 2016

@kalpeshtailored Can you log a successful test then?

@kalpeshtailored
Copy link

I have tested this item ✅ successfully on bfda664

Tested successfully.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@hardiktailored
Copy link

I found z-index issue with popover while editing article. Check the "Tags" option in image below. I also notice that border cuts down in smaller screens but I think real device may not have same issue because I am testing using Chrome(Version 48.0.2564.103 (64-bit)) mobile testing tool.
screen shot 2016-07-12 at 02 14 09


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@Bakual
Copy link
Contributor Author

Bakual commented Jul 12, 2016

I don't think the z-index issue is something that has to be fixed. Select options most likely should stay on top anyway.
Anyway, this would be unrelated to this PR as it would be a general issue with popovers (and most likely tooltips as well).

@rahultailored
Copy link

I have tested this item ✅ successfully on bfda664

I checked in latest staging CMS Joomla! 3.6.0-rc.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8174.

@roland-d
Copy link
Contributor

@Bakual I was testing this issue and have a question. Can the search field of the Search Tools have a popover as well?

screen shot 2016-07-16 at 07 33 28

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 16, 2016
@Bakual
Copy link
Contributor Author

Bakual commented Jul 16, 2016

@roland-d Sure, We just would have to change this line: https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/searchtools/default/bar.php#L39 to call popover instead of tooltip.
And in https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/searchtools/default/bar.php#L39 remove the tooltipText call and change it to directly insert title and data-content attributes.

@roland-d
Copy link
Contributor

@Bakual Do you want to do that in this PR or should we get a separate one for that?

@Bakual
Copy link
Contributor Author

Bakual commented Jul 16, 2016

I'd rather do it in an own. This one is for the places where there is a title and description present. The searchfield only has one of it so it would be something else.

@roland-d roland-d added this to the Joomla 3.6.1 milestone Jul 16, 2016
@roland-d roland-d merged commit 90db0ff into joomla:staging Jul 16, 2016
@roland-d
Copy link
Contributor

@Bakual Fair enough, merged this one :)

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jul 16, 2016
@Bakual Bakual deleted the UsePopovers branch July 16, 2016 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.