reiern70 opened a new pull request, #1619:
URL: https://github.com/apache/wicket/pull/1619

   ## Summary
   
   The jQuery 4.0.0 migration (WICKET-7179) mechanically rewrote several 
`box.focus()` calls as `box.trigger('focus')`, without checking whether the 
receiver was actually a jQuery object. A follow-up fix already corrected two 
spots (`wicket-ajax-jquery.js`, `trap-focus.js`'s focus restore), but missed 
two others, both of which throw a `TypeError` on `wicket-10.x` (10.9.0+):
   
   - `Wicket.Palette.moveUpHelper` in `palette.js` calls `box.trigger('focus')` 
where `box` is a plain DOM `<select>` from `document.getElementById`. Clicking 
the "move up" button on an ordered `Palette` throws before the hidden recorder 
input is updated, so the reorder is silently discarded on the next render. 
"move down" is unaffected. Fixes GitHub issue #1618.
   - `Wicket.trapFocus`'s keydown handler in `trap-focus.js` calls 
`.trigger('focus')` on `$focusable.get(0)` / `.get(length - 1)`, which are 
plain DOM elements (unlike the file's other two calls, which go through 
`.first()` and are fine). Tabbing/Shift-tabbing past the boundary of a 
focus-trapped container (e.g. a `ModalDialog`) throws instead of wrapping focus 
around.
   
   `master` is unaffected by either — it later dropped jQuery from these files 
entirely and uses `.focus()` directly. `wicket-9.x` and `wicket-8.x` predate 
the jQuery 4 migration and also use `.focus()`. So both fixes are 
`wicket-10.x`-only.
   
   ## Changes
   
   - Two commits, each with its fix and a regression test.
   - Adds a QUnit harness for wicket-extensions' client-side JavaScript 
(`wicket-extensions/src/test/js/`), wired into the existing `grunt`/`-Pjs-test` 
build via a second `connect` server target (port 38888) — previously only 
wicket-core's JS was exercised at runtime; wicket-extensions JS was only linted.
   
   ## Test plan
   
   - [x] `grunt jshint connect qunit` in `testing/wicket-js-tests` — 230 tests, 
0 failed (jQuery 3.7.1 and 4.0.0).
   - [x] Verified both new tests fail against the pre-fix code (reproducing the 
`TypeError`) and pass after the fix.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to