Skip to content

Commit f60a073

Browse files
committed
Dialog: Document _allowInteraction() extension point.
1 parent 4daead3 commit f60a073

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

entries/dialog.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,22 @@
345345
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
346346
<xi:include href="../includes/widget-method-widget.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
347347
</methods>
348+
<extension-points>
349+
<method name="_allowInteraction" return="Boolean">
350+
<desc>
351+
Modal dialogs do not allow users to interact with elements behind the dialog. This can be problematic for elements that are not children of the dialog, but are absolutely positioned to appear as though they are. The <code>_allowInteraction()</code> method determines whether the user should be allowed to interact with a given target element; therefore, it can be used to whitelist elements that are not children of the dialog but you want users to be able to use.
352+
</desc>
353+
<argument name="event" type="Event"/>
354+
<example>
355+
<desc>Allow the Select2 plugin to be used within modal dialogs. The <a href="/jquery.widget/#method-_super"><code>_super()</code></a> call ensures elements within the dialog can still be interacted with.</desc>
356+
<code><![CDATA[
357+
_allowInteraction: function( event ) {
358+
return !!$( event.target ).is( ".select2-input" ) || this._super( event );
359+
}
360+
]]></code>
361+
</example>
362+
</method>
363+
</extension-points>
348364
<example>
349365
<desc>A simple jQuery UI Dialog</desc>
350366
<code><![CDATA[

0 commit comments

Comments
 (0)