You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by re...@apache.org on 2026/05/13 13:45:36 UTC

(wicket) branch wicket-10.x updated: [WICKET-7179] fix broken focus functionality

This is an automated email from the ASF dual-hosted git repository.

reiern70 pushed a commit to branch wicket-10.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-10.x by this push:
     new 776cf72529 [WICKET-7179] fix broken focus functionality
776cf72529 is described below

commit 776cf7252944dbaaf13081c39923662355c88530
Author: reiern70 <re...@gmail.com>
AuthorDate: Tue May 12 17:18:13 2026 -0500

    [WICKET-7179] fix broken focus functionality
---
 .../src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js  | 3 ++-
 .../org/apache/wicket/extensions/ajax/markup/html/modal/trap-focus.js  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 67a3111116..c54f552d52 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -2202,7 +2202,8 @@
 
 						var safeFocus = function() {
 							try {
-								toFocus.trigger('focus');
+                                // toFocus is not a JQuery object. Thus use focus.
+								toFocus.focus();
 							} catch (ignore) {
 								// WICKET-6209 IE fails if toFocus is disabled
 							}
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/trap-focus.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/trap-focus.js
index 8157833042..d8b49822ac 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/trap-focus.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/trap-focus.js
@@ -110,7 +110,8 @@
 			// ... restore old focus
 			if (oldActive) {
 				try {
-					oldActive.trigger('focus');
+                    // oldActive is not a JQuery element. Then use focus
+					oldActive.focus();
 					Wicket.Log.debug("trap-focus: restored focus to element ", oldActive);
 				} catch (error) {
 					Wicket.Log.error("trap-focus: error restoring focus. Attempted to set focus to element, but got an exception", oldActive, error);