Spinner: Unable to enter values after ajax update
See original GitHub issueDescribe the bug
We are currently encountering a problem, where it is not possible to enter new values into a p:spinner
input after it was refreshed by an Ajax update. The spinner definition looks like this:
<p:spinner value="#{bean.value}" min="1" max="99999" size="10" />
I’ve done some debugging and it seems like the problem is related to the keydown
event handler defined in spinner.js
. It uses event.key
for some checks, where event
references the global window.event
variable. In some cases in Chrome, event
points to a different event than the keydown
event, or is even undefined. Then these checks will fail and the value will not get updated.
According to MDN, the window.event
property is deprecated, so it maybe is no longer supported in Chrome or other browsers.
The solution would be quiet simple, by replacing the window.event
reference with the event passed as parameter to the event listener.
I can provide a PR for this if desired.
Reproducer
Unfortunately the problem seems to depend heavily on external conditions, like events and other ajax requests happening on the page, so I cannot provide a reproducer.
Expected behavior
It should be possible to enter values after an ajax update.
PrimeFaces edition
Community
PrimeFaces version
10.0.0
Theme
No response
JSF implementation
MyFaces
JSF version
2.3.9
Browser(s)
Chrome 103
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
I see what you mean. I just submitted a PR and letting the Integration Tests run.
MonkeyPatch:
Great, thanks for the quick fix!