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

feat(Tabs): replace mobile dropdown tabs with overflow nav buttons #6410

Merged
merged 50 commits into from
Aug 27, 2020

Conversation

emyarod
Copy link
Member

@emyarod emyarod commented Jul 8, 2020

Closes #4758

This PR removes the dropdown tabs variant at small screen sizes and replaces it with a scrollable tab list and overflow nav buttons. Light component variants are also introduced. The overflow indicator fade effect is similar to the modal body and code snippet overflow indicator fade effect (and faces the same limitations when using CSS custom properties, and the same limitations with transparent gradients in Safari #4769)

Changelog

New

  • scrollable tab list with overflow navigation buttons
  • light tabs
  • light container tabs

Removed

  • mobile dropdown tabs variant

Testing / Reviewing

Confirm the overflow tabs and overflow container tabs match the component spec in visuals and behavior. The component should be navigable with the keyboard and with the mouse. When using the overflow nav buttons, reaching the end of the tab list will hide the overflow nav button at that edge and move focus to the currently selected tab

@emyarod
Copy link
Member Author

emyarod commented Jul 8, 2020

the storybook preview will depend on #6403

@netlify
Copy link

netlify bot commented Jul 8, 2020

Deploy preview for carbon-elements ready!

Built with commit 8de39bd

https://deploy-preview-6410--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Jul 8, 2020

Deploy preview for carbon-components-react ready!

Built with commit 8de39bd

https://deploy-preview-6410--carbon-components-react.netlify.app

@netlify
Copy link

netlify bot commented Jul 8, 2020

Deploy preview for carbon-elements ready!

Built with commit 44d55cb

https://deploy-preview-6410--carbon-elements.netlify.app

@netlify
Copy link

netlify bot commented Jul 8, 2020

Deploy preview for carbon-components-react ready!

Built without sensitive environment variables with commit 44d55cb

https://deploy-preview-6410--carbon-components-react.netlify.app

@aagonzales
Copy link
Member

I'm getting this error in the storybook:
image

@tw15egan
Copy link
Collaborator

tw15egan commented Jul 8, 2020

@aagonzales should be fixed once the storybook is re-deployed, fix was just merged in 👍

Copy link
Member

@aagonzales aagonzales left a comment

Choose a reason for hiding this comment

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

It's looking good! Just a couple of bugs.

  1. The disabled border is disappearing in the light variants. Using disabled-02 won't work because it will actually make it higher contrast than the other unselected line. Let's update the disabled border-bottom to keep using ui-03 like the unselected tabs.
    • image
  2. Container tabs label spacing is off. The label should be vertically centered in the tab.
    • As is image
    • To be image
  3. Is there anything we can do about the scroll bar showing up when using the keyboard and when you click the arrow?
    Jul-08-2020 15-34-54

@emyarod emyarod force-pushed the 4758-xs-tabs branch 3 times, most recently from 544de88 to 1264bc5 Compare July 9, 2020 17:30
@emyarod
Copy link
Member Author

emyarod commented Jul 9, 2020

locally I couldn't reproduce the container tab label issue but I think I resolved it in storybook. the light disabled tabs should now have the updated color token. as for the scroll bar issue, I'm not sure what we can do about that especially since it also changes depending on the user's operating system etc.

Copy link
Member

@aagonzales aagonzales left a comment

Choose a reason for hiding this comment

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

Looks good! 🎉

@joshblack
Copy link
Contributor

joshblack commented Jul 14, 2020

Running into some weird situations with the scrollbar 🤔 To reproduce, I have a mouse connected (or scrollbars always visible) and am trying to drag across

demo

Also ran into some issues with navigating with arrow keys, seems like it may cut off the label potentially of the tab that is focused:

demo

@emyarod
Copy link
Member Author

emyarod commented Jul 14, 2020

the mouse scrollbar issue is probably due to the component width changing when the overflow button is rendered, not sure why it is only present for mouse but I may have to check somehow if the user is scrolling with scroll wheel / track pad versus dragging the scroll bar

the auto scroll on focus is only implemented for the first and last tabs currently but I can look into recalculating scroll position for every navigation action

<div
{...other}
className={classes.tabs}
role={role}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this role="nav"? Having the tabs in a tablist should be enough as far as roles are concerned unless there's something I'm missing.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is carried over from the existing implementation (carbon-design-system/carbon-components-react#2318). what is the recommendation here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just took a look at our design guidance for tabs

If the tabs are 'default' then the nav role makes sense actually. If it's a 'container' version then we can follow the APG guidance and leave it out. If that's a pain in the neck having the nav role in there isn't a blocker. Since it reads and operates fine, just a little wonky and verbose in JAWS.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please take out the nav for the 'container' Tabs. See: #2272

I'm not quite sure what 'default' Tabs are, but typically you would want to leave landmark design, like adding a nav, main, etc, up to the page author. (i.e. I think the nav should probably be taken out of 'default' Tabs, too).

className={classes.tabs}
role={role}
onScroll={this.handleScroll}>
<button
Copy link
Contributor

Choose a reason for hiding this comment

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

  • these overflow buttons should be aria-labeled
  • when using JAWS/NVDA/VoiceOver to navigate the tablist with these buttons the tabs (and their selection) isn't announced. Maybe an aria-live would help here?
  • during testing only the 'rendered when selected' tab is read when selected, which makes sense since the DOM is being updated. Unless there's something I'm forgetting we probably want the tab panels to be read when the tab is selected in the tablist. Like mentioned above aria-live in conjunction with aria-atomic could be cool here.

Copy link
Contributor

@dakahn dakahn Jul 14, 2020

Choose a reason for hiding this comment

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

Worth noting as well here -- and maybe something we document somewhere -- is that NVDA and VO totally ignore the overflow buttons altogether and just let the user access the whole tablist. This seems like what we want (so of course JAWS doesn't do that lol)

Not a blocker, just wanted to note that here for future docs

Copy link
Member Author

Choose a reason for hiding this comment

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

just FYI we can add aria-live to the tab content container by default but the user can render any content they would like so we won't be able to account for that

Copy link
Contributor

Choose a reason for hiding this comment

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

Before you code any live regions, please watch Sarah Higley’s Live Regions talk. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I won't be adding that attribute, due to the users ultimately having control over the tab content as I mentioned previously!

this.handleOverflowNavButtonClick(event, { direction: 1 })
}>
<ChevronRight16 />
</button>
</div>
{tabContentWithProps}
Copy link
Contributor

@dakahn dakahn Jul 14, 2020

Choose a reason for hiding this comment

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

Overflow tabpanel content is always read by my readers -- even if it isn't expanded. We could either fix that and have text read truncated and call out the expand button, or hide the button (consider it only a visual affordance) and just have screen reader users have immediate access to all the tab panel content. 🤔

The as-is is kinda weird in that the screen reader user can read the whole panel, and then sees the expand button that technically does nothing for them.

Copy link
Member Author

Choose a reason for hiding this comment

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

this behavior is also carried over from the existing non mobile tabs. given that mentioned a couple of options, what would be the recommendation here?

Copy link
Contributor

@dakahn dakahn Jul 14, 2020

Choose a reason for hiding this comment

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

is truly truncating the text -- not just visually an option? If not we could just set aria-hidden on the show more button

Copy link
Member Author

Choose a reason for hiding this comment

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

by "show more button" are you referring to the overflow buttons? if so, would aria-hidden clash with the suggestion to add aria-labels above?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I meant the show more button for the tab panel content.

Copy link
Member Author

Choose a reason for hiding this comment

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

that's part of the code snippet and is separate from the tabs component

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, of course!

@dakahn
Copy link
Contributor

dakahn commented Jul 14, 2020

Just a general question for the review team here -- are we testing on mobile? I have an Android and can test there if that's helpful. @tw15egan @aagonzales

@aagonzales
Copy link
Member

Ha what a logical question @dakahn. No i didn't actually try it on a mobile device but I will now!

@tw15egan
Copy link
Collaborator

@dakahn I usually test mobile in-browser unless it's a mobile-specific fix. Will verify on a device with this one 👍

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

👍 ✅ 🎉

Copy link
Member

@aagonzales aagonzales left a comment

Choose a reason for hiding this comment

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

Skeleton looks good now!

@cal-smith
Copy link
Contributor

cal-smith commented Sep 8, 2020

FYI This ended up being a breaking change - Really would have appreciated a deprecation notice on the bx--tabs-trigger. Fixing this on our side (Angular) also means we would end up breaking users on older Carbon minor releases, so I'm not sure if there's an easy path forward here, outside of adding some slightly hacky styles.

@cal-smith cal-smith mentioned this pull request Sep 9, 2020
emyarod added a commit to emyarod/carbon that referenced this pull request Sep 9, 2020
emyarod added a commit to emyarod/carbon that referenced this pull request Sep 9, 2020
emyarod added a commit to emyarod/carbon that referenced this pull request Sep 9, 2020
emyarod added a commit to emyarod/carbon that referenced this pull request Sep 18, 2020
emyarod added a commit to emyarod/carbon that referenced this pull request Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tabs] remove dropdown variant for tabs
9 participants