Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug - Popover/Modal - Modals and popover do not render properly when Fullscreen API is used

オープン
#11,919 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
54/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
react, typescript
領域
frontend

調査の方向性

まず Modal と popover の appendTo 処理から始め、次にフルスクリーンへの移行時と終了時に、提供された CodeSandbox を再現します。フルスクリーン中は modal が document.fullscreenElement 内にレンダリングされ、その後 document.body に戻ることを、両方向の遷移を含めて確認します。

索引モデルが issue の本文から書いたものです。

説明

Stale

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時間
マージ済み PR(30日)
9

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

patternfly/patternfly-react のほかの issue

patternfly/patternfly-react の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。