We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fef6e7 commit 8917533Copy full SHA for 8917533
jquery.pjax.js
@@ -263,6 +263,17 @@ function pjax(options) {
263
264
if (container.title) document.title = container.title
265
context.html(container.contents)
266
+
267
+ // FF bug: Won't autofocus fields that are inserted via JS.
268
+ // This behavior is incorrect. So if theres no current focus, autofocus
269
+ // the last field.
270
+ //
271
+ // http://www.w3.org/html/wg/drafts/html/master/forms.html
272
+ var autofocusEl = context.find('input[autofocus], textarea[autofocus]').last()[0]
273
+ if (autofocusEl && document.activeElement !== autofocusEl) {
274
+ autofocusEl.focus();
275
+ }
276
277
executeScriptTags(container.scripts)
278
279
// Scroll to top by default
0 commit comments