Skip to content

Commit

Permalink
fix: popup zIndex 设置错误 (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
honkinglin authored Jan 27, 2022
1 parent a7992a6 commit aacb6f8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"start-server-and-test": "^1.14.0",
"tdesign-icons-view": "^0.0.1",
"tdesign-publish-cli": "^0.0.9",
"tdesign-site-components": "~0.5.44",
"tdesign-site-components": "~0.5.52",
"ts-jest": "^27.1.2",
"ts-morph": "^13.0.02",
"ts-node": "^10.4.0",
Expand Down
2 changes: 1 addition & 1 deletion site/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function Components(props) {
<td-doc-aside ref={tdDocAsideRef} title="React for Web">
{versionOptions.length ? (
<div slot="extra">
<Select value={version} options={versionOptions} onChange={changeVersion} />
<Select popupProps={{ zIndex: 800 }} value={version} options={versionOptions} onChange={changeVersion} />
</div>
) : null}
</td-doc-aside>
Expand Down
8 changes: 4 additions & 4 deletions src/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ const Popup = forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
const { styles, attributes } = popperRef.current;

const defaultStyles = useMemo(() => {
if (triggerRef && typeof overlayStyle === 'function') return { ...overlayStyle(triggerRef), zIndex };
return { ...overlayStyle, zIndex };
}, [overlayStyle, zIndex, triggerRef]);
if (triggerRef && typeof overlayStyle === 'function') return { ...overlayStyle(triggerRef) };
return { ...overlayStyle };
}, [overlayStyle, triggerRef]);

// 设置 style 决定展示与隐藏
const overlayVisibleStyle: CSSProperties = defaultStyles;
Expand Down Expand Up @@ -165,7 +165,7 @@ const Popup = forwardRef<HTMLDivElement, PopupProps>((props, ref) => {
<CSSTransition in={visible} appear {...cssTransitionState.props}>
<div
ref={composeRefs(setOverlayRef, ref)}
style={styles.popper}
style={{ ...styles.popper, zIndex }}
className={`${classPrefix}-popup`}
{...attributes.popper}
{...popupProps}
Expand Down

0 comments on commit aacb6f8

Please sign in to comment.