-
Notifications
You must be signed in to change notification settings - Fork 125
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
fix: (Platform) remove dependency on position: fixed for Dynamic Page #4343
Conversation
Deploy preview for fundamental-ngx ready! Built with commit a02b604 |
libs/platform/src/lib/components/dynamic-page/dynamic-page.component.ts
Outdated
Show resolved
Hide resolved
libs/platform/src/lib/components/dynamic-page/dynamic-page.component.ts
Outdated
Show resolved
Hide resolved
f192da0
to
6b030e1
Compare
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.
Hi @kavya-b , unfortunately the issue is not fixed. The issue was detected by an application using Flexible Column Layout together with Platform Dynamic Page.
The way you can reproduce the issue is:
- Go to
flexible-column-layout-example.component.html
and as a content for#midColumn
template add the Dynamic Page example with Tabs - Add the necessary imports for Button, Breadcumb, Bar, Toolbar, etc
- When you test the example now you will have this:
- Open the example:
- Click the button to show the second column of the Flexible column layout:
- The result is:
Because the position of the header is fixed, and you specify left:0, etc the header is now taking the whole width of the page, but not the width of the container. In this case the header should fit in the second column space.
Let me know if you need more info
@InnaAtanasova I see.. seems to be a problem with |
Hi @kavya-b This issue with This can bring some unexpected behaviour for users - since we're pretty ready for release, I suggest @InnaAtanasova what do you think? |
I am not in favour of merging this PR as it's not really fixing the issue. If we merge it this means that the component can be used in only one specific case where it's used as a page layout and takes the whole width of the window. From what I see most of the use cases are when the component is part of a wrapper, not limited to Flexible column layout. The position should not be fixed. @JKMarkowski solution could work and is a better approach that the current using the styles. |
@InnaAtanasova @JKMarkowski 2021-01-19_10-04-21.mp4
|
6b030e1
to
ad29bd1
Compare
@InnaAtanasova @JKMarkowski have removed |
ad29bd1
to
b95fcda
Compare
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.
Hi @kavya-b, I added some comments. IMO current dynamic page is too complicated.
Dynamic page looks like that:
Most of the things are not needed just to have it in this way.
The only thing you will need to calculate for this proposition is height of content.
So you can apply on init, or header expand just a height of content:
100vh - distance from top - offset(which is added by user)
Let me know what do you think about this approach, if it does make any sense.
In general right now it works much better than before. Great job!
.header-sticker, .tab-sticker { | ||
position: absolute; | ||
width: 100%; | ||
top: 0; | ||
} |
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.
Could you keep it static instead of absolute?
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.
changed to static as suggested
const contentComponentElement = this.contentComponent.getElementRef().nativeElement; | ||
|
||
contentComponentElement.style.top = this.header.nativeElement.offsetHeight + 'px'; | ||
this._addClassNameToCustomElement(contentComponentElement, 'content-sticker'); |
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.
There is no need to add top
anywhere. You can easily do it without applying top
by applying static/relative positions
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.
removed usage of top. Thanks for showing me this approach, Jedrzej!
this._addClassNameToCustomElement(tabList, 'tab-sticker'); | ||
tabList.style.top = this.header.nativeElement.offsetHeight + 'px'; |
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.
Same, with static/relative you won't need to add it
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.
removed usage of top
if (tabContent) { | ||
tabContent.forEach((contentItem) => { | ||
const element: HTMLElement = contentItem | ||
.getElementRef() | ||
.nativeElement.querySelector('.fd-dynamic-page__content'); | ||
if (element) { | ||
element.style.top = this.header.nativeElement.offsetHeight + tabList.offsetHeight + 'px'; | ||
} | ||
}); | ||
} |
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.
That's also the thing that you won't need with relative/static
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.
removed usage of top
this._addClassNameToCustomElement(tabList, CLASS_NAME.dynamicPageTabs); | ||
this._addClassNameToCustomElement(tabList, CLASS_NAME.dynamicPageTabsAddShadow); | ||
this._renderer.setStyle(tabList, 'z-index', 1); | ||
|
||
if (this.header) { | ||
this._renderer.setStyle(this.header.nativeElement, 'z-index', 2); | ||
} | ||
|
||
if (this.size) { | ||
this._setTabsSize(this.size, tabList); | ||
} | ||
|
||
if (!this.headerComponent?.collapsible) { | ||
return; | ||
} | ||
|
||
const pinCollapseShadowElement = this._elementRef.nativeElement.querySelector( | ||
'.fd-dynamic-page__collapsible-header-visibility-container' | ||
); | ||
|
||
if (pinCollapseShadowElement) { | ||
this._addClassNameToCustomElement( | ||
pinCollapseShadowElement, | ||
CLASS_NAME.dynamicPageCollapsibleHeaderPinCollapseNoShadow | ||
); | ||
} |
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.
Let's recheck if this is still needed, when applied static/relative position
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.
this is still needed as it is unrelated to positioning. It adds some necessary modifier classes to the tabs.
I see.. did not know about this approach of using viewheight for calculating content height. So we are keeping header and footer as is(with static/relative) and content position will be static/relative but with a height of the calculated value; is my understanding correct? What would the I still somehow feel that setting |
I was thinking about offset just in case user wants to put something below the dynamic page. It can be provided by the user with The only issue can be meet with stacked content, but user should handle it by himself in this case |
- also add z-index so that tabs in dynamic page have more weight than tabs in content, avoiding one visible behind the other on scrolling
- minor documentation selector name refactoring
fix failing unit test
-removed unnecessary code
b95fcda
to
a02b604
Compare
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.
Looks much better. Great Job!
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.
Awesome work!
Please provide a link to the associated issue.
#4337
Please provide a brief summary of this pull request.
position: fixed
in Dynamic Page that was causing other side-effects like appearing over the entire page and not taking up its parent's space. We are now usingposition: static
. Also added an example for using with Flexible Column Layout.Before:
After:
fd-tabs
used within the page. It fixes the issue by applying more specificity to the dynamic page tab styles application.Before:
After:
Within tabbed dynamic page example, styles will only apply to dynamic page tabs, not user-provided tabs in content:
Please check whether the PR fulfills the following requirements
https://github.com/SAP/fundamental-ngx/blob/main/CONTRIBUTING.md
https://github.com/SAP/fundamental-ngx/wiki/PR-Review-Checklist
Documentation checklist:
README.md