-
-
Notifications
You must be signed in to change notification settings - Fork 337
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(menu): add tab overflow scrolling and shadows #2776
base: develop
Are you sure you want to change the base?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 2 places, as examples, inside your PR which need changes. Beside my other comment, you should take care of such for future changes. Those are needed at several places , which i havent marked because of my other overall comment
.ui.top.attached.tabular.menu { | ||
overflow: visible; | ||
width: 100%; | ||
min-width: fit-content !important; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
div
s 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
div
s right before and after the menu tabs:After these
div
s 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