feat(menu): add tab overflow scrolling and shadows#2776
feat(menu): add tab overflow scrolling and shadows#2776SeanSun6814 wants to merge 2 commits intofomantic:developfrom
Conversation
|
Thanks for investigating and proposing a possible solution. 👍 Here is my experience while trying your jsfiddle:
Here is a quick draft i played around removing the extra divs and placing left/right items instead. Yes, those would need javascript, but .tab() actually is a module, so we can add such logic here. Such logic could change the scrollposition upon click (or implement a dragging functionality), which works everywhere. Again, thanks for getting into this, and lets discuss how to proceed. |
| .ui.top.attached.tabular.menu { | ||
| overflow: visible; | ||
| width: 100%; | ||
| min-width: fit-content !important; |
There was a problem hiding this comment.
dont use !important, use repeating classnames to increase specificity instead
| } | ||
|
|
||
| .ui.top.attached.tabular.menu > .item.active { | ||
| border-bottom: 1px solid #fff; |
There was a problem hiding this comment.
Use a LESS variable instead of hardcoding the value
I did come up with something in #1868 that did scrolling and overflow (using dropdown) menu, depending on what was needed (auto detected if mobile) and would be useful in |
Description
Currently, when there are too many tabs on a menu such that they exceed the width of its container width, they overflow off the page. As mentioned in issue #1501, there are two ways this could be fixed:
In this PR (@SeanSun6814, @jessxec), we address both of them. It allows the tabs to be scrollable if it overflows. When some tabs are hidden to the left or right, there are shadows on either side indicating that more tabs can be scrolled to.
In order to activate these features, the user needs to add some more HTML
divs in their code.Specifically, to have the scroll feature, the user should wrap the menu tabs div with another div:
To have the shadows feature, the user should add the following
divs right before and after the menu tabs:After these
divs are added, the CSS added into the fomantic library will automatically apply to them.In the future, it might be worth looking into having these features without additional user code.
Testcase
Demo before the fix (from the issue #1501): https://codesandbox.io/s/fomantic-tab-issue-v6er3?file=/src/App.js
Demo after the fix: https://jsfiddle.net/jessxec/64L293uk/31
Screenshot
Before the fix:
After the fix:
Closes
#1501