doAction( “focus_area” )

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

Fires, after an area received the “focus” state.

If the page contains multiple Popups, only one Popup can have the “focus” state at any moment.

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


(DiviAreaItem) The Area which will be focused.


// Add a special CSS class to the focused Area.
DiviArea.addAction( 'focus_area', function( area ) {
    area.addClass( 'special-focus' );


During the “focus” process, all event handlers are attached to the Area (i.e., custom close buttons are initialized, etc). At the end of that process, the focus_area event is fired.

Was this article helpful?

Related Articles