By lauriii on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.2.x
Introduced in version:
10.2.0
Issue links:
Description:
New refocus-blur setting has been added to AJAX API. This allows configuring whether the focus should return to the element that was focused before the browser processing the AJAX response, or on the element that element that is triggering the AJAX event. refocus-blur is enabled automatically if the event listener is attached to a blur event.
It is possible to override this behavior:
$form['textfield_focus_tests']['textfield_2'] = [
'#type' => 'textfield',
'#title' => 'Textfield',
'#ajax' => [
'callback' => [static::class, 'textfieldCallback'],
'event' => 'blur',
'refocus-blur' => FALSE,
],
];
Impacts:
Module developers