doAction( “close_area” )

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Actions
  6. doAction( “close_area” )
DiviArea.doAction( 'close_area', area, closeType );
DiviArea.doAction( 'close_area_{id}', area, closeType );

Fired internally to trigger a stoppable close-request. If the request is not stopped, it will end in calling DiviArea.hide().

The {id} part in the hook name is the sanitized area-ID (all lower case, dashes changed to underscores).


(DiviAreaItem|null) The Divi Area that should be hidden.
A null-value instructs the plugin to close the top-most Area, which is identical as calling DiviArea.hide() without a parameter.
(string) The event that caused the close_area action. It can be one of the following values:

* default .. The user clicked on the default close button of the Area (in the top right corner).
* custom .. A custom close button inside the Area was clicked.
* esc .. The user pressed the Escape key.
* overlay .. The user clicked the overlay.

The types esc and overlay are only used by Popups. Other Area-Types can be closed only via a close button.


// Output a console message when an Area should be closed.
DiviArea.addAction( 'close_area', function( area, closeType ) {
    if ( area ) {
        var key = area.getKey();
        console.log( 'The area', key, 'is about to be closed. Reason:', closeType );
    } else {
        console.log( 'The top-most area is closed. Reason:', closeType );


The close_area action can be stopped by reacting to the ignore_close_area filter.

If you want to hide an Area, it is easier to call DiviArea.hide( area ). The action is mainly used internally by the JS API.

Was this article helpful?

Related Articles