Skip to content
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

Show all breadcrumbs in a popover #2342

Merged
merged 26 commits into from
Sep 24, 2019

Conversation

daveyholler
Copy link
Contributor

@daveyholler daveyholler commented Sep 13, 2019

Summary

Allows all breadcrumbs to be displayed in a popover. Useful when the list is truncated, but you still want users to be able to navigate to anywhere in the breadcrumbs list.

Checklist

  • Checked in dark mode
  • Checked in mobile
  • Checked in IE11 and Firefox
  • Props have proper autodocs
  • Added documentation examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@daveyholler
Copy link
Contributor Author

jenkins test this

@ryankeairns
Copy link
Contributor

Tried this out quick, its a nice enhancement to navigation!

A couple of quick observations regarding keyboard navigation...

  • It would be helpful to have some sort of focus state when you're on an actionable, truncated breadcrumb. As it stands, you cannot visibly tell that you are on the ellipsis breadcrumb
  • Once opened (via spacebar), we should probably trap focus in the popover and use ESC to exit/close the popover.

🤔 I wonder if this should be the default behavior of the breadcrumb component?

@cchaos
Copy link
Contributor

cchaos commented Sep 16, 2019

Furthering @ryankeairns' comments is that there's also no visual difference between the ellipsis that's clickable the one that is not. As a user, I could get used to the clickable version then think the other one is broken. Or get used to the non-clickable version and never know that there is a clickable version.

I'm not sure what a good solution is, however. I think making it our primary color may stand out too much. It could just be the text color instead of grayed out, but it that enough. Maybe for now it is enough since even the regular clickable breadcrumbs are text colored.

Or do we have a breadcrumb coloring problem in general? (Which doesn't need to be solved in this PR)/

@cchaos
Copy link
Contributor

cchaos commented Sep 18, 2019

@daveyholler Is this ready for review?

@daveyholler
Copy link
Contributor Author

@cchaos It is :)

@cchaos
Copy link
Contributor

cchaos commented Sep 18, 2019

Quick design question while I review the code. Do you think it's expected that when clicking the "middle" truncated area, that the popover would show the full list instead of just those that are missing?

I'm honestly on the fence. But just gauging if others felt some awkwardness with that.

@daveyholler
Copy link
Contributor Author

@cchaos I thought about that too, and concluded that the extra two items (1 on even smaller screens) was a small tradeoff for the full context. 🤷‍♂

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When changing truncate to true, the badge seems to shift in place.

CHANGELOG.md Outdated Show resolved Hide resolved
src/components/breadcrumbs/_breadcrumbs.scss Outdated Show resolved Hide resolved
src/components/breadcrumbs/_breadcrumbs.scss Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/_breadcrumbs.scss Outdated Show resolved Hide resolved
@cchaos
Copy link
Contributor

cchaos commented Sep 18, 2019

...concluded that the extra two items (1 on even smaller screens) was a small tradeoff for the full context

That's only if the consumer provided a max of 3, what if the max was 10 and there were 20 items? Again, not advocation one way or the other, but we just need to think about all scenarios.

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more things.

src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
src/components/breadcrumbs/_breadcrumbs.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, one more thing. Please add a test for this new prop.

CHANGELOG.md Outdated Show resolved Hide resolved
src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with one small nit and with @chandlerprall's approval

// array so that all we have left are the items that aren't
// visible on screen. Only do it when showMaxPopover is true
if (showMaxPopover) {
for (let i = breadcrumbsToRemove.length - 1; i >= 0; i--) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My head hurts. 🤕 @chandlerprall would you mind glancing over this logic. It does work, I'm just wondering if there's a more compact way to handle it?

src/components/breadcrumbs/breadcrumbs.js Outdated Show resolved Hide resolved
daveyholler and others added 2 commits September 19, 2019 14:01
Co-Authored-By: Caroline Horn <549577+cchaos@users.noreply.github.com>
Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM, thanks @daveyholler !

@daveyholler daveyholler merged commit 1076aeb into elastic:master Sep 24, 2019
@cchaos cchaos mentioned this pull request Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants