react-router-breadcrumbs icon indicating copy to clipboard operation
react-router-breadcrumbs copied to clipboard

Last "crumb" should be text

Open jasonnathan opened this issue 8 years ago • 3 comments

Hi, thanks for the great library. I used this instead of react-breadcrumbs solely because of the resolver - which is awesome.

However, like @svenanders's library, I think the last crumb should be just plain text instead of a link.

jasonnathan avatar Nov 09 '16 04:11 jasonnathan

Hi, thanks for using this library and sorry for the late response.

This can be achieved by passing in the createLink-prop as of now. E.g

createLink = (link, key, text, index, routes) => {
  if (index === routes.length -1) {
    return <span key={key}>{text}</span>;
  }
  return <Link to={link} key={key}>{text}</Link>;
}

So what this really boils down to is what should the default behavior be. And secondary, should the library provide some helpers for common defaults.

I must admit I'm wondering into some unknown territories at this point, and this these kind of changes deserves some extra attention. I'll let this issue stay open and investigate a bit regarding what people expect in such situations. If this change is critical for your usecase please let me know so I can speed up the process.

nutgaard avatar Nov 09 '16 19:11 nutgaard

Thanks for the snippet @nutgaard. Just curious, shouldn't the functionality ideally be the other way around? Where the last crumb is text and you'd used createLink to make it a link?

Considering its called createLink :p

jasonnathan avatar Nov 10 '16 01:11 jasonnathan

That is what I'm wondering too. But it may have some usability issue especially for people using assistive technology, it may be easier to use if all the elements in the list are equal.

Considering the semantics of createLink I feel it is more precise with the current implementation as all it does is to create a link, whereas the proposal would change this to "create links and a span". Though a better name (especially on the api-level) would propably be something like createCrumbElement as it does not imply any specific implementation.

nutgaard avatar Nov 11 '16 23:11 nutgaard