patternfly / patternfly-elements

PatternFly Elements. A set of community-created web components based on PatternFly design.
https://patternflyelements.org/
MIT License
378 stars 96 forks source link

pfe-tabs overflow scrolling #1013

Open dcaryll opened 4 years ago

dcaryll commented 4 years ago

Overflow scroll button

Applied to the Horizontal component when labels are too long and get cut off. There's no specific breakpoint for when a Scroll button appears, it depends on the number of labels and the character count of each label.

Quick links

Styles and interactions

Horizontal, light context

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/d334e6a9-c875-4ed3-90da-2cd9f60a31a2/Open-Tabs-horizontal-overflow-light-theme

Horiz scroll button - Primary, Open, Wind, light theme

Angle or arrow styles

Button BG styles

Default

IX - Overflow button, light theme, default

Focus

NA

Hover

IX - Overflow button, light theme, hover

Active/Pressed

IX - Overflow button, light theme, active pressed

Horizontal, dark context

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/68c6d18d-354c-4a2d-9f6f-228c28b25fd0/Open-Tabs-horizontal-overflow-dark-theme

Horiz scroll button - Primary, Open, Wind, dark theme

Angle or arrow styles

Default

IX - Overflow button, dark theme, default

Focus

NA

Hover

IX - Overflow button, dark theme, hover

Active/Pressed

IX - Overflow button, dark theme, active pressed

Interactivity

Default state

Active/Pressed

Tab order

Tab order Overflow animation

dcaryll commented 4 years ago

@kylebuch8 created this as a placeholder where we can add the details.

coreyvickery commented 4 years ago

@diwanshi Ready, please reach out to me with any questions.

cc @kylebuch8

kylebuch8 commented 3 years ago

@coreyvickery - I have a couple of questions for you.

  1. Should will allow the text to wrap on tabs? image

  2. I feel like the left and right arrows on a mobile view occupy a lot of horizontal space making it only possible to see a little more than two tabs at once. Do you think we should change things for mobile? image

kylebuch8 commented 3 years ago

@coreyvickery For reference, on mobile, if I remove the left and right arrows and prevent the text from wrapping, here's how things would look.

image

coreyvickery commented 3 years ago

@kylebuch8 I don't know if I like the look of wrapping tab labels and scrolling. Isn't the whole point of scrolling to be a solution for long tab labels so they don't have to break?

kylebuch8 commented 3 years ago

@coreyvickery Here's a preview link to what I've got going on. https://deploy-preview-1698--patternfly-elements.netlify.app/elements/pfe-tabs/demo/horizontal-scroll.html

I've prevented text wrap on the tabs. But you'll notice when you go down to a mobile size, sometimes you only see 1.5 to 2 tabs because of the arrows.

Let me know what you think.

coreyvickery commented 3 years ago

@kylebuch8 I think I'm okay with there being only one or two tabs visible on mobile because that layout is very thin anyways, it starts to look better when the layout gets wider. Is this replacing pfe-content-set?

On a related note, the visible scroll bar is killing me. Is it a red flag if we were to hide that? PatternFly seems to be doing something similar and you can still scroll through the tabs with your mouse and each tab with your keyboard.

https://www.patternfly.org/v4/components/tabs#default-overflow

Screen Shot 2021-07-01 at 11 54 00 AM
kylebuch8 commented 3 years ago

@coreyvickery Cool. Thanks for the comment.

As for replacing pfe-content-set, I think that component still serves a purpose because sometimes it's nice to be able to see all of the content options at once as an accordion where scrollable tabs might inadvertently hide content.

@kelsS Can you weigh in on hiding the scrollbar? I know the scrollbar provides some accessibility benefits as well as a visual affordance to show that there is more content. But with the arrows that we're adding to the right and the left, is the scrollbar still needed?

kelsS commented 3 years ago

Hi @kylebuch8 I think we are okay to remove the scrollbar since we are providing a comparable experience. That being said we need to ensure that the contrast of those arrows meets AA standards, extra care needs to be taken with the contrast of the arrows when they are disabled because you have reached the end of the content on either side since there will be no scroll bar to indicate that.

kylebuch8 commented 3 years ago

@kelsS Thanks. That helps.

@coreyvickery Can you make the necessary color adjustments to the disabled arrow so they are AA compliant? Once you have the hex values, let me know what they are.

coreyvickery commented 3 years ago

@kylebuch8 @kelsS How do we feel about these options?

Light theme

Wind variant

Open Tabs - Horizontal - Overflow - Light theme

Earth variant

Box Tabs - Horizontal - Overflow - Light theme

The disabled overflow button arrow in the light theme is #6a6e73 with a contrast of 5.13.

Dark theme

Wind variant

Open Tabs - Horizontal - Overflow - Dark theme

Earth variant

Box Tabs - Horizontal - Overflow - Dark theme

The disabled overflow button arrow in the dark theme is #8a8d90 with a contrast of 5.47.


Hover state

Light theme

Open Tabs - Horizontal - Overflow - Light theme - Hover

Dark theme

Open Tabs - Horizontal - Overflow - Dark theme - Hover

I pulled these styles from PatternFly. Are we okay with only a color change for the button arrow hover state? It might be hard to see the change if a user has color blindness. Maybe we can add a subtle background shift or something that doesn't depend on color only.