UserFrosting
UserFrosting copied to clipboard
ufCollection - Selected rows aren't removed from dropdown
Noticed this while porting over to the new template pattern. Initially thought I'd busted something, but further investigation revealed this issue was pre-existing,
In a nut shell, you can endlessly select items, provided the item just clicked on is allowed to leave the 'depressed' button state.
Observed in Edge and Chrome.
On my install, when editing the role permissions, I can't select the same permission twice in a row. But if I select User, then Group, then I can select user again. Those are not saved twice though. So it's not you or your edits.
At the same time, when the modal is first loaded, it shoudn't display in the collection dropdown the one already in the table.
Yeah, I want to add this as an option at some point (actually, I had tried to implement it before but I couldn't get it to work). Basically we need to keep track of the id's of the added items internally, and then pass them to the API endpoint (if used). Probably with some sort of exclude
parameter.
I wouldn't call this a bug, though. In some circumstances, the ability to add an element multiple times, might actually be the desired behavior.
In the scenario, it is expected that an option that's already been selected would disappear from the dropdown (hence the confirm bug tag). If we want to fix this, and implement a feature in the process, fair enough.
But the fact is, this is a bug. If it were a feature, you'd be able to click on the same dropdown item to endlessly add it, but alas this isn't the case due to it needing to be 'depressed'.
Maybe it's a bug in the specific context of the way we're using it for user roles and role permissions?
To quote myself "...but alas this isn't the case due to it needing to be 'depressed'." Once you've clicked on a dropdown open, you can't click on it again right away. You have to shift the focus to another item. I'll throw an gif together to illustrate what I'm talking about if necessary.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Completely forgot I had something do to on this. I'll add it to my list.
This gif illustrates the issue.
To be clear, this here is indeed a bug. While selecting something multiple times is something that people may want to be able to do, that strictly speaking isn't always possible as some filtering is being applied.
Back when I first created this issue, the instances of the same entry appearing was achieved by deleting different intermediate rows which evidently created some confusion.