-
Notifications
You must be signed in to change notification settings - Fork 2
You can not use :after nor :before if you use tooltips #150
Comments
Yes, and we all agreed with that. We decided to try with simple CSS only tootlips. But now I also think that this is too big limitation. |
In fact, the problem is not the fact that you can not add |
Some problem is that every button has a tooltip even when the tooltip is not necessary and at default |
Can't you wrap it with any class and just provide the same interface? Is there really a problem? |
It's not that simple to provide the same interface (https://github.com/ckeditor/ckeditor5-ui-default/blob/master/src/button/buttonview.js#L34-L96). You will need to update it every time But what do you think about wrapping the template in such cases: this.template = new Template( {
tag: 'div',
attributes: {
class: 'can-have-before-and-after'
},
children: [ this.template ]
} ); I just checked it and it works, with small fixes in the |
I like it :) |
But this will be a second way to extending a template. |
I guess it makes a perfect sense. |
Will be closed in https://github.com/ckeditor/ckeditor5-ui/issues/119. |
Hm... this issue is not covered by ckeditor/ckeditor5-ui#119. It will not be covered until we won't rewrite this using JS. |
The question is: is this still a real issue? I fixed
and it works just fine. And ckeditor/ckeditor5-ui#118 allowed easier manipulation in the template tree, which should solve most of the cases. |
I think it is. It's not a critical issue, but it's annoying. You can't easily have a dropdown button with a tooltip and triangle. Wrapping it with another element breaks the icon (which, according to what @pjasiun said lands in the wrong place now)... In fact, I don't like the idea of changing the template of an existing component any more (I must've been sleepy previously) :D. What I initially proposed (#150 (comment)) is far cleaner and safer, although requires maintaining the new interface, so it's less convenient at first. But there are more solutions or improvements which we can consider.
Finally, I'll repeat this once more – we've got a perfect example here of how subclassing can go wrong. Wrapping the template of an existing element creates a new type of a component because template is its interface too. We can see now that it broke the icon placement (so the internals of this component), but I can easily imagine that it can also break its integration with e.g. dropdown if we were a bit careless and made the dropdown component try adding class to the button (which I think we did in the past). So:
|
Agree with @Reinmar (and @oskarwrobel who did not like it from the beginning) that wrapping template is not a good practice. The template change is fine, because I still think that using a template as a another template child is fine, but we should not use it for wrapping the views template in subclasses. |
So, in other words, this issue is about converting tooltips into independent JS views at some point in the future? |
Most probably, if there is no better way to avoid using :after and :before. |
You can not use
:after
nor:before
if you use tooltips. It means, for instance, that you can not use triangle to indicate that the button is a dropdown if you use tooltip: https://github.com/ckeditor/ckeditor5-theme-lark/blob/78a54836975b699a5862388ff05c0eebbb7cfaa8/theme/components/dropdown.scss#L4-L23 what worked fine before. All other usages of:before
or:after
will be broken if you use a tooltip. It looks like a big limitation for developers and I think we should consider other (JS) solution for tooltips.The text was updated successfully, but these errors were encountered: