Conversation
| if (!items.find(i => i.selected)) items[0].selected = true; | ||
| const selectedItems = items.filter(i => i.selected); | ||
| if (selectedItems.length === 0) items[0].selected = true; | ||
| if (selectedItems.length > 1) { // unselect all but the first selected item |
There was a problem hiding this comment.
This was added so the d2l-view-switcher-button demo would work properly on the component page
There was a problem hiding this comment.
Is this an existing bug, or were consumers expected to listen to the event and update the selected values accordingly (and know no longer need to)?
There was a problem hiding this comment.
A bug I found while working on the demos, thankfully there are no consumers outside of core(search)
There was a problem hiding this comment.
Gotcha. It looks like this is unselecting all but the first item, not all but the first unselected item? As in, if the second and third are both selected, it unselects both of those.
There was a problem hiding this comment.
It unselects all but the first selected item, I added a test for the use case
There was a problem hiding this comment.
Ah you're right, missed the initial filtering! 🤦♀️
|
Thanks for the PR! 🎉 We've deployed an automatic preview for this PR - you can see your changes here:
Note The build needs to finish before your changes are deployed. |
There was a problem hiding this comment.
I think you want the README up a level, not in the demo folder?
| import '../view-switcher-button.js'; | ||
| import '../../list/list-item-content.js'; | ||
| import '../../list/list-item.js'; | ||
| import { css, html, LitElement } from 'lit'; |
There was a problem hiding this comment.
Looks like this doesn't work properly with our published static demo pages. Other demo pages that do this (like labelled-mixin) also aren't working, and I guess we didn't notice.
|
🎉 This PR is included in version 3.220.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
GAUD-9538
Adding a README and improving the demos for
d2l-view-switcher