Bug - Popover/Modal - Modals and popover do not render properly when Fullscreen API is used
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 54/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- react, typescript
- 領域
- frontend
研究方向
先從 Modal 和 popover 的 appendTo 處理開始,然後在進入和退出全螢幕時重現提供的 CodeSandbox。驗證在全螢幕期間 modal 是否在 document.fullscreenElement 內呈現,並在之後返回 document.body,包括兩個方向的轉換。
由索引模型根據 Issue 內容生成。
描述
Describe the problem
A clear and concise description of the problem. Which components are affected?
When the fullscreen API is used, the browser does not render the entire document tree. Popovers and modals, which append to document.body by default might not be included in the scope of the fullscreen element.
How do you reproduce the problem?
Provide steps to reproduce. A codesandbox demonstrating the problem is appreciated.
adapted from https://www.patternfly.org/components/modal#basic-modals:
import * as React from 'react';
import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';
export const useFullscreen = () => {
/_* The element that will be toggled to fullscreen _/
const fullscreenRef = React.useRef(null);
/_* Toggle currently displayed content to/from fullscreen _/
const toggleFullscreen = React.useCallback(() => {
if (fullscreenRef.current) {
if (!document.fullscreenElement) {
fullscreenRef.current.requestFullscreen();
} else {
document.exitFullscreen();
}
}
}, []);
return [fullscreenRef, toggleFullscreen];
};
export const ModalBasic: React.FunctionComponent = () => {
const [isModalOpen, setIsModalOpen] = React.useState(false);
const [fullscreenRef, toggleFullscreen] = useFullscreen();
const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {
setIsModalOpen(!isModalOpen);
};
return (
[div ref={fullscreenRef}]
[Button onClick={toggleFullscreen}]toggle fullscreen[/Button]
[Button variant="primary" onClick={handleModalToggle} ouiaId="ShowBasicModal"]
Show basic modal
[/Button]
[Modal
isOpen={isModalOpen}
onClose={handleModalToggle}
ouiaId="BasicModal"
aria-labelledby="basic-modal-title"
aria-describedby="modal-box-body-basic"
]
[ModalHeader title="Basic modal" labelId="basic-modal-title" /]
[ModalBody id="modal-box-body-basic"]
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
[/ModalBody]
[ModalFooter]
[Button key="confirm" variant="primary" onClick={handleModalToggle}]
Confirm
[/Button]
[Button key="cancel" variant="link" onClick={handleModalToggle}]
Cancel
[/Button]
[/ModalFooter]
[/Modal]
[/div]
);
};
Expected behavior
A clear and concise description of the expected behavior.
The modal appends to the fullscreenElement when the browser is fullscreen
Is this issue blocking you?
List the workaround if there is one.
Sort of..? This is causing issues in #15254 and my workaround is to simply disable any elements that generate popovers when the browser is fullscreened
Screenshots
If applicable, add screenshots to help explain the issue.
What is your environment?
Firefox 140.0-1.fc42
What is your product and what release date are you targeting?
OCP console 4.20
Any other information?
We can update the default value of appendTo to be () => document.fullscreenElement ?? document.body which will probably fix this. We will need to update the value of appendTo dynamically when the user exit and enters fullscreen however
Jira Issue: PF-2357
- 主要語言
- TypeScript
- 星號
- 862
- 分支
- 392
- 平均合併
- 4 天 8 小時
- 30 天內合併 PR
- 9
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
patternfly/patternfly-react 的其他 Issue
-
PF Team
難度 2/5 1-3 小時 新手友好度 68/100
patternfly/patternfly-react#12651 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
patternfly/patternfly-react#12637 ·
-
PF Team
難度 2/5 1-3 小時 新手友好度 72/100
patternfly/patternfly-react#12617 · 1 則留言 ·
-
PF Team
難度 2/5 1-3 小時 新手友好度 68/100
patternfly/patternfly-react#12610 · 1 則留言 · 1 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 68/100
patternfly/patternfly-react#12600 ·
查看 patternfly/patternfly-react 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 則留言 ·
-
external-issue to-triage
難度 2/5 1-3 小時 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
難度 2/5 半天 新手友好度 86/100
-
難度 2/5 1-3 小時 新手友好度 82/100
-
refactor
難度 2/5 1-3 小時 新手友好度 84/100