# profile-builder/4.0.0/form-builder/blocks/src/components/ForceDisableFullscreen.js

User Profile Builder – Beautiful User Registration Forms, User Profiles &amp; User Role Editor, version 4.0.0. 45 lines.

- Page: https://pluginprobe.com/plugins/profile-builder/4.0.0/code/form-builder/blocks/src/components/ForceDisableFullscreen.js
- Raw: https://pluginprobe.com/plugins/profile-builder/4.0.0/raw/form-builder/blocks/src/components/ForceDisableFullscreen.js
- Modified: 2026-08-17T08:51:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/profile-builder/4.0.0/code/form-builder/blocks/src/components/ForceDisableFullscreen.js#L10-L20`.

```javascript
/**
 * Keep fullscreen off on PB form CPTs without writing the global
 * `fullscreenMode` preference. Strip `is-fullscreen-mode` from body and
 * re-strip on MutationObserver (PB CPTs only).
 */

import { useEffect } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import { registerPlugin } from '@wordpress/plugins';

const PB_CPTS = [ 'wppb-rf-cpt', 'wppb-epf-cpt' ];
const FULLSCREEN_CLASS = 'is-fullscreen-mode';

const ForceDisableFullscreen = () => {
    const postType = useSelect(
        ( select ) => select( 'core/editor' ).getCurrentPostType(),
        []
    );
    const isOurPostType = PB_CPTS.includes( postType );

    useEffect( () => {
        if ( ! isOurPostType ) return undefined;

        const body = document.body;
        if ( ! body ) return undefined;

        const strip = () => {
            if ( body.classList.contains( FULLSCREEN_CLASS ) ) {
                body.classList.remove( FULLSCREEN_CLASS );
            }
        };

        strip();

        const observer = new MutationObserver( strip );
        observer.observe( body, { attributes: true, attributeFilter: [ 'class' ] } );

        return () => observer.disconnect();
    }, [ isOurPostType ] );

    return null;
};

registerPlugin( 'wppb-fb-force-disable-fullscreen', { render: ForceDisableFullscreen } );

```
