fix: Modal open should not block dropdown hidden (#44204)

* refactor: adjust style

* fix: not event when hovering

* chore: add comment
This commit is contained in:
二货爱吃白萝卜 2023-08-14 16:31:57 +08:00 committed by GitHub
parent 72b449a1a4
commit ee984fee0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,10 +62,7 @@ export interface ModalToken extends FullToken<'Modal'> {
function box(position: React.CSSProperties['position']): React.CSSProperties { function box(position: React.CSSProperties['position']): React.CSSProperties {
return { return {
position, position,
top: 0, inset: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
}; };
} }
@ -95,6 +92,7 @@ export const genModalMaskStyle: GenerateStyle<TokenWithCommonCls<AliasToken>> =
zIndex: token.zIndexPopupBase, zIndex: token.zIndexPopupBase,
height: '100%', height: '100%',
backgroundColor: token.colorBgMask, backgroundColor: token.colorBgMask,
pointerEvents: 'none',
[`${componentCls}-hidden`]: { [`${componentCls}-hidden`]: {
display: 'none', display: 'none',
@ -103,9 +101,16 @@ export const genModalMaskStyle: GenerateStyle<TokenWithCommonCls<AliasToken>> =
[`${componentCls}-wrap`]: { [`${componentCls}-wrap`]: {
...box('fixed'), ...box('fixed'),
zIndex: token.zIndexPopupBase,
overflow: 'auto', overflow: 'auto',
outline: 0, outline: 0,
WebkitOverflowScrolling: 'touch', WebkitOverflowScrolling: 'touch',
// Note: Firefox not support `:has` yet
[`&:has(${componentCls}${antCls}-zoom-enter), &:has(${componentCls}${antCls}-zoom-appear)`]:
{
pointerEvents: 'none',
},
}, },
}, },
}, },
@ -120,14 +125,6 @@ const genModalStyle: GenerateStyle<ModalToken> = (token) => {
// ======================== Root ========================= // ======================== Root =========================
{ {
[`${componentCls}-root`]: { [`${componentCls}-root`]: {
[`${componentCls}-wrap`]: {
zIndex: token.zIndexPopupBase,
position: 'fixed',
inset: 0,
overflow: 'auto',
outline: 0,
WebkitOverflowScrolling: 'touch',
},
[`${componentCls}-wrap-rtl`]: { [`${componentCls}-wrap-rtl`]: {
direction: 'rtl', direction: 'rtl',
}, },