-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add a set of breadcrumb DX components #309
Comments
Thanks for the issue! I am hugely in favor of this!
(need) only if there is an a11y benefit to doing so
I am not sure, would require research. Some prior art though (and we may want to borrow some API design from here as well -- the simple case for the Svelte one is very nice):
this may be something we want to control, as one of the goals of ember-primitives is to encode many of the non-default a11y patterns
how do you mean? |
Sorry meant to say
Probably not necessary for first implementation/release, but I'm thinking ahead of if teams would want a way to modify the separator before/after a given breadcrumb. Giving a good DX and determining what "wins" could be real 🤮 though. And all that is for a "what if" (I don't personally have a use in our apps but this was more thinking for maximum customization) |
I would be surprised by this, as I've never seen per-item separator customization |
Thinking about it having a "the instantiation modifies separator, this could be accomplished by omitting the export const Separator = <template>
<div class="mx-4" ...attributes>
<ChevronIcon />
</div>
</template>
export const ParentComponentSomewhere = <template>
<BreadcrumbRenderer class="flex items-center space-x-2 bg-gray-500 border rounded">
<:item as |BreadcrumbItem|>
<BreadcrumbItem class="inline-flex items-center hover:text-blue-200" />
</:item>
<BreadcrumbRenderer>
<Breadcrumb as |bc|>
<a href="/">
<HomeIcon />
Home
</a>
{{#unless bc.isLast}}<Separator />{{/unless}}
</Breadcrumb>
<Breadcrumb>
<a href="/forum">Forum</a>
{{#unless bc.isLast}}<Separator class="some-customization-to-separator" />{{/unless}}
</Breadcrumb>
...
</template> It's not perfectly equal to a per instance separator, since now the stuff you're using to separate each item is in the same element as the breadcrumb contents, but... I think it gives maximum flexibility without really weird edge cases |
that's true -- might be worth adding to docs as an example, I suppose if someone really wanted to! 🙃 🎉 |
There's still room to go and the module scope main...rtablada:ember-primitives:rt/poc-breadcrumb There's some WIP and proof of concept stuff in there. I mainly wanted to feel the basic handling and see far |
Breadcrumb management would be really useful to have in this library.
It's a fairly common pattern for child interfaces to want to "push" a breadcrumb into a parent state without having implementation of where the actual breadcrumb is rendered higher in the component tree
Thinking about a potential public API for this, could be.
This would result in something to the effect of the following HTML being rendered in the DOM where the
BreadcrumbRenderer
was invoked:Considerations:
:separator
block?ember-primitives
aims to be "bring your own CSS/HTML" and forcing teams into psuedo selectors will not be universally compatible:separator
could be optional and when the block doesn't exist then nothing would be rendered between items, this could allow teams to still use psuedo selectors if they chose:separator
need to yield a component?BlockSeparator
component does allow some flexibilityaria
roles/attrs that should be enforced?Breadcrumb
?isFirst or isLast: boolean
(in case teams want to add something likearia-current="page"
to the last breadcrumb [though this could be out of sync if more child UIs are rendered without adding their own breadcrumb])Breadcrumb
have a way to modify its associatedselectorseparator?The text was updated successfully, but these errors were encountered: