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

Pivot: Support overflowing pivots #4066

Closed
quanglefed opened this issue Feb 22, 2018 · 33 comments · Fixed by #13631
Closed

Pivot: Support overflowing pivots #4066

quanglefed opened this issue Feb 22, 2018 · 33 comments · Fixed by #13631

Comments

@quanglefed
Copy link

Hi all,

I think this would be nice. Do we have any plan to handle Pivots are overflowed.?

Thank in advance,
Quang Le

@dzearing dzearing changed the title [ Pivot - feature requests ] Is there any way to handle Pivots are overflowed. Pivot: have a way to have headers overflow. Jun 21, 2018
@JasonGore JasonGore added this to the Backlog milestone Aug 15, 2018
@micahgodbolt
Copy link
Member

@betrue-final-final is this something we have a design for, or something we want to support? If there is a different pattern we should be following instead, that's fine too.

@micahgodbolt
Copy link
Member

Consider refactoring pivot using base of pagination control. At that point supporting overflowing of pivot items. #7254

@Jahnp
Copy link
Member

Jahnp commented Apr 3, 2019

I believe the expected behavior would be for Pivots to scroll horizontally once they've exceeded their container's width. That's the pattern I've seen most frequently for this kind of behavior. @betrue-final-final , would be curious to hear if you have different thoughts.

@shaipetel
Copy link

Same here, there isn't even a trigger we could handle the overflow ourselves.
A good solution would be either to scroll the tabs horizontally, or to automatically collapse the over-flowed items into a "..." more drop down menu, when the page is resized and there is not enough room to render fully.

Anyone has a solution for this?

@shaipetel
Copy link

For now, I'm doing it manually but adding a style to the pivot element:

<Pivot styles={{ root: { display: 'flex', flexWrap: 'wrap' } }}>

Works, but doesn't look great...

Just putting it out there in case anyone needs it.

@shaipetel
Copy link

Another way i found was to give them a specific width, and make the text in the tab trncated with ...

using (for example with 4 tabs):
<Pivot styles={{ linkIsSelected: { width: '25%' }, link: { width: '25%' }, text: { overflow: 'hidden', textOverflow: 'ellipsis', width: '100%' } }}>

and override the PivotItem render item link:

  return (<div style={{ width: '100%' }}>
    {defaultRenderer!(link)}
  </div>);
}}```

@brandonthomas
Copy link
Contributor

Just as a design note: Pivots should never stack like that. It might 'solve' the overflow issue but it creates other problems and isn't an approved design. We should solve this holistically and thoughtfully within the component before we have multiple teams and products doing various different things here. I think ideally, all the places we have Pivots (UWP, Web, etc) align.

@joetheday
Copy link
Member

Agreed. It's also worth mentioning that a fixed width will not work for a couple of reasons:

  • The current pivot indicator should be the width of the string
  • Will have inconsistent spacing between pivot items with long and short string lengths
  • Localization will be problematic

@shaipetel
Copy link

Of course, a proper solution is much needed here, in the form of an overflow menu (...), or any other clever solution you come up with.

Since in my design I do not know the number or names of tabs I cannot hard code something like that with reasonable effort, I’m ok with my patches for now.

@pratikgupta2
Copy link

I need Pivot to be rendered as vertical tabs with more than 9 tabs. Any suggestions ?

@betrue-final-final
Copy link
Member

Yes @shaipetel is correct. We should leverage the common Fabric pattern of the overflow. Here’s the states:
image

and examples:
image

Pretty simple. If a pivot in the overflow is selected, then the selection visual should be used.

@sayali26
Copy link
Collaborator

@micahgodbolt is there an ETA for this ?

@micahgodbolt
Copy link
Member

micahgodbolt commented Dec 18, 2019

a dev has been working on a solution, but it has been more difficult than expected to support this feature without regressing the existing control.

#11270

@brandonthomas
Copy link
Contributor

@micahgodbolt can we get an update here? We're blocked on this for many features.

@micahgodbolt
Copy link
Member

@brandonthomas can you combine a pivot and resizeGroup to enable those features? I don't see a way to make this change without breaking existing users. A fully responsive pivot (that changes its default behavior) would need to be in a major release or new control

@brandonthomas
Copy link
Contributor

@micahgodbolt I think putting the onus on all the consumers here is going to be a hard pill for most to swallow and will make it so all apps have to do this work custom not just us. Is there anything else that can be done to support it? Can we create a ResponsivePivot component that does that so we have consistency? We feel like it's a major change and not a minor not from an API perspective but because it would move items into a context menu?

@brandonthomas
Copy link
Contributor

Additionally, ResizeGroup doesn't work when there are in-app width changes as it hooks into window resize. So if you have elements adjusting size within the app or panels coming in it won't catch that from what I can tell in the component.

@brandonthomas
Copy link
Contributor

@micahgodbolt or @xugao in order for this to work with in app resizes the only path forward I see is to basically build my own ResizeObserver based ResizeGroup and then wrap Pivot in that, and then adjust what PivotItems are shown, and if I can't fit them, toss them into an overflow. Do you see another option? This feels like a heavy lift for every team to make to get WCAG 2.1 compliant.

@powerchelle
Copy link

Could the FluentUI team provide a recommendation in CodePen while we are waiting for something to be built into the library? Without this, users are building their own reflow stories and losing not only cohesion where it's needed but also the benefit of using a shared library that otherwise has high standards for accessibility and usability.

@dzearing
Copy link
Member

Evaluating this right now.

@dzearing
Copy link
Member

dzearing commented May 6, 2020

An update:

  • This would be a breaking change, so we're scaffolding this in react-next, our v8 prerelease package
  • The code is being converted to function components presently and that's almost completed
  • The styles will be converted to sass and css variables to leverage our performance improvements and unified theming model.
  • The design mentioned above has some issues that we're hoping to resolve with @betrue-final-final before implementing (would prefer to use a carousel model instead of the dropdown option.)

@brandonthomas
Copy link
Contributor

@dzearing do we have a guestimate on when this will be available in v8? I'm ok with waiting a bit but if it's something like March next year we'll have to do something in the short to intermediate time frame to address.

@ecraig12345 ecraig12345 added the WCAG 2.1 400% zoom and other WCAG 2.1 issues label May 22, 2020
@dzearing
Copy link
Member

The guestimate here is that it will start in June. We're closely tracking. @behowell is working on this.

@dzearing dzearing assigned behowell and unassigned micahgodbolt May 27, 2020
@dzearing
Copy link
Member

dzearing commented Jun 5, 2020

Work is currently in progress.

@hoovercj
Copy link
Member

@dzearing you said you "would prefer to use a carousel model instead of the dropdown option." but it looks like the the PR by @behowell is back to an overflow menu. I'm curious what factors made the carousel model untenable

@msft-github-bot msft-github-bot added Status: Fixed Fixed in some PR and removed Status: In PR labels Jul 13, 2020
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.