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

fix(ObjectPage): always show focused element when Tabbing in content #6004

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
}
}

.objectPage:has([data-component-name='ObjectPageFooter']) {
/* bar height + padding */
scroll-padding-block-end: calc(var(--_ui5_bar_base_height) + 1.5rem);
}

.iconTabBarMode section[data-component-name='ObjectPageSection'] > div[role='heading'] {
display: none;
}
Expand Down
22 changes: 13 additions & 9 deletions packages/main/src/components/ObjectPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { ObjectPageMode } from '../../enums/index.js';
import { addCustomCSSWithScoping } from '../../internal/addCustomCSSWithScoping.js';
import { safeGetChildrenArray } from '../../internal/safeGetChildrenArray.js';
import { useObserveHeights } from '../../internal/useObserveHeights.js';
import { cssVarVersionInfoPrefix } from '../../internal/utils.js';
import type { CommonProps, Ui5CustomEvent } from '../../types/index.js';
import type { AvatarPropTypes, TabContainerDomRef } from '../../webComponents/index.js';
import { Tab, TabContainer } from '../../webComponents/index.js';
Expand Down Expand Up @@ -807,8 +808,17 @@ const ObjectPage = forwardRef<HTMLDivElement, ObjectPagePropTypes>((props, ref)
[classNames.headerHoverStyles]
);

const getStickyHeaderHeight = useCallback(
(collapsedPadding = topHeaderHeight) =>
headerPinned || scrolledHeaderExpanded
? `${topHeaderHeight + (headerCollapsed === true ? 0 : headerContentHeight)}px`
: `${collapsedPadding}px`,
[topHeaderHeight, headerCollapsed, headerContentHeight]
);

const objectPageStyles: CSSProperties = {
...style
...style,
scrollPaddingBlockStart: `calc(${getStickyHeaderHeight()} + var(${cssVarVersionInfoPrefix}tc_header_height_text_only)`
};
if (headerCollapsed === true && (headerContent || titleInHeader)) {
objectPageStyles[ObjectPageCssVariables.titleFontSize] = ThemingParameters.sapObjectHeader_Title_SnappedFontSize;
Expand Down Expand Up @@ -858,10 +868,7 @@ const ObjectPage = forwardRef<HTMLDivElement, ObjectPagePropTypes>((props, ref)
ref={anchorBarRef}
className={classNames.anchorBar}
style={{
top:
scrolledHeaderExpanded || headerPinned
? `${topHeaderHeight + (headerCollapsed === true ? 0 : headerContentHeight)}px`
: `${topHeaderHeight + 5}px`
top: getStickyHeaderHeight(topHeaderHeight + 5)
}}
>
<ObjectPageAnchorBar
Expand All @@ -883,10 +890,7 @@ const ObjectPage = forwardRef<HTMLDivElement, ObjectPagePropTypes>((props, ref)
className={classNames.tabContainer}
data-component-name="ObjectPageTabContainer"
style={{
top:
headerPinned || scrolledHeaderExpanded
? `${topHeaderHeight + (headerCollapsed === true ? 0 : headerContentHeight)}px`
: `${topHeaderHeight}px`
top: getStickyHeaderHeight()
}}
>
<TabContainer
Expand Down
Loading