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
My impressions on alpha.3 #35
Comments
What if we think in a way to send a component as a parameter dynammically, using portals, like |
I've built an working example on stackblitz.com: https://stackblitz.com/edit/popover-example The red color under each option helps to show the problem by marking the Then, if you uncomment the last lines in styles.scss, you can make it a lot better, but cannot get rid of the problem completely. |
Another important observation is that you will also notice that when the Also, both This made me think whether making the hover (specifically) event an out-of-the-box feature isn't a good idea. Right now I haven't figured out a solution to fire the popover on select panel's open event (Should I have to code anything in [edit => BTW, bootstraps's popover I'm currently using in my other project, also have the same behavior: until I move the mouse over the option, I don't see the popover] |
First, I'm so happy to see that you're putting it through its paces so quickly! The feedback is wonderful! Re: option templating, I think Re: dynamically creating and controlling popovers, between ngFor and ViewChildren, I think most cases should be covered. I'd like to get to snackbar-like usage so more logic can be encapsulated inside a popover, but I'm more concerned about being able to easily set a scroll strategy or focus behavior.. and those pesky tests... Re: hover/focus events, I'll try to play around with it sometime this week and see what I can come up with. If there are no ways to determine which option is currently active, I agree, there should be. Maybe you can combine |
I had never used |
I've sent it to production. It'll be used for about 50 users (3 to 4 of them on a daily basis) and I'll keep an eye on it for eventual issues, but I honestly think that there will be any. [edit]: "... honestly think that there WON'T be any" |
Haha yeah, placing <ng-container *ngIf="user$ | async; let user;">
<div class="name">{{ user.name }}</div>
<img [src]="user.img">
</ng-container> I think I will still remove the default click behavior in the short term. A longer term goal may be to have something like <div [satAnchorFor]="myPopover" satTogglePopoverOn="hover focus longpress">
...
</div>
<div [satAnchorFor]="differentPopover" satTogglePopoverOn="focus click">
...
</div> |
I think this would be nice because of some caveats, like disabling the backdrop on hover events. In this case,what would be the default behavior:
|
Probably 2. I'm afraid though that it will get complicated to prioritize defaulted behavior if you have conflicting needs. As in,
A better solution may just be to briefly explain in the readme how to create a variety of behaviors, what the backdrop does, and StackBlitz demo(s) showing several common use cases. Now that you understand that the backdrop blocks hover events, it makes sense, right? I think if that were presented upfront in the README, it wouldn't have been so perplexing. |
😲 I haven't thought of that...
I agree. |
@julianobrasil did you ever figure out a good way to get the I think this issue can be closed unless I'm forgetting something. There is a blurb in the readme about how the backdrop can effect hover behavior, and it's now opt-in, which I think helps. In the back of my mind, I'm considering extending the anchor in ways like |
No. I've noticed material tooltip has the same behavior. We are not alone 😄
You can be proud of your work. I wouldn't change it. It's so easy to use and so versatile at the same time. I doubt someone will ever complain. Oh, and I haven't close this because I was not sure whether you were using it to track anything. IMO it can be closed. The onOpen thing is not directly related to satPopover. It's kind of a general js question. |
BTW, I really liked that speed dial example in stackblitz.com. |
Will, I've noticed today that the combination Have you done anything? Or have Material guys done? [edited 1]: Or have Chrome guys done? I've checked out your old stackblitz example and it's working fine (Alpha.3). [edited 2]: I think Chrome guys did something: the issue remains in Edge. |
Good catch! It did not work in v61 but does in v62 |
Look at what I got:
As you can notice from the gif above,:
@Input() disableBackdrop
The second observation has an hidden implication: as I need one anchor to each
sat-popover
, I was forced to encapsulate every option content in a component - see the code bellow. Themat-option
content is the anchor for thesat-popover
- ideally, the anchor would be themat-option
itself not its content - but I'll talk about this later in this issue.Sorry about the awkward example (bellow) to show my point, but I tried to reproduce approximately what I have in above gif [edited => the code bellow is in stackblitz.com].
and in the class:
Then I can use this component like this (
mat-form-field
's width is important to show my point):As I need an unique anchor for each popover, I made this custom component to encapsulate each of the popover and it's anchor.
As I said earlier, ideally, the anchor should be the
mat-option
element, but I couldn't figure out how to put it in the custom component. I triedngProjectAs="mat-option"
, but apparentlymat-option
is not ang-content
element:As it didn't work, what I managed to do is encapsulating
mat-option
content along withsat-popover
instead ofmat-option
itself. So I'm using adiv
inside the custom component to hold the option content and be the anchor for the popover.This have a side effect: I had to override the
mat-option-text
class so it takes 100% of the availablemat-option
width, otherwise the popover would apear in the middle of themat-option
instead of by its side. Even overriding themat-option-text
class, if you look carefully, you can see in the gif that the popover overlapped themat-select
pannel a little bit.The overlapping is acceptably small, but if I had to make it goes completely outside the panel, I don't kwow what I could do without hacking the component.
The summary of the problem: When I have an undetermined number of dynamically fed
sat-popover
in a component, I'm not able (at least I couldn't figure out how) to put an anchor in a component directly, without encapsulating the popover, what may have side effects in some specific situations like what is discribed in this issue. This would happen also if I was using another component with a separate trigger element, likemat-menu
. The problem is to put the anchor in the correct element, once it is buried inside another custom component.sat-popover
? Or a limitation ofmat-option
?@willshowell
The text was updated successfully, but these errors were encountered: