Re: [webcomponents] slot element's fallback contents is never used (#317)

+1 from me as well. I've had multiple use cases where fallback content for slots has been tremendously convenient. 

Ex: Passing a list of items to a custom drop down component – if a list of items is passed, the element should display the list. If nothing is included in the component, the developer may want it to contain a default "no options available" empty state. 

Ex: (real life example here) A custom element that automagically inlines SVG from an SVG sprite as its shadow content. In an effort to make things accessible by default, it would be appropriate to include default screen reader text in a named slot. Perhaps a slot called "sr-label" with the default content "beautiful icon" for example. However, if a user wants to provide their own screen reader label copy that may be more descriptive of the actual use case, they are more than able to.

I also agree with @travisleitheid and enjoy the parallels it has to host element fallback content, it's a good mental model.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/317#issuecomment-142845971

Received on Thursday, 24 September 2015 08:01:42 UTC