You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Lars Mallinckrodt (Jira)" <ji...@apache.org> on 2022/08/21 11:45:00 UTC

[jira] [Updated] (WICKET-6997) OnChangeAjaxBehavior blocks first subsequent button click

     [ https://issues.apache.org/jira/browse/WICKET-6997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Mallinckrodt updated WICKET-6997:
--------------------------------------
    Description: 
I have a simple form with a TextField and an AjaxButton. The button is disabled initially and is being enabled after typing something in the TextField using an OnChangeAjaxBehavior (see attached quickstart). Enabling the button works as expected.

However, when clicking on the button after the OnChangeAjaxBehavior has fired, the first click is ignored. It is only after a second click on the button that the onSubmit() method is triggered.

Looking at the JS console, it seems that the first click triggers another "input change" event due to the focus change:
{code:json}
{
  "u": "./?3-1.0-form-input",
  "m": "POST",
  "c": "inputd",
  "e": [
    "input change"
  ],
  "event": {
    "originalEvent": {
      "isTrusted": true
    },
    "type": "change",
    "target": {},
    "currentTarget": {},
    "timeStamp": 4471,
    "jQuery360038239900837477336": true,
    "delegateTarget": {},
    "handleObj": {
      "type": "change",
      "origType": "change",
      "data": null,
      "guid": 4,
      "namespace": ""
    },
    "data": null
  },
  "ch": "0|s",
  "wr": true,
  "dt": "xml",
  "async": true,
  "rt": 0,
  "pd": false,
  "sp": "bubble",
  "sr": false
}
{code}
But the actual click event seems to be lost.


After that, the next button click triggers the "click" event as expected:
{code:json}
{
  "u": "./?3-1.0-form-submit",
  "m": "POST",
  "c": "submit10",
  "f": "forme",
  "sc": "p::submit",
  "e": [
    "click"
  ],
  "pd": true,
  "event": {
    "originalEvent": {
      "isTrusted": true
    },
    "type": "click",
    "target": {},
    "currentTarget": {},
    "relatedTarget": null,
    "timeStamp": 28490,
    "jQuery360038239900837477336": true,
    "delegateTarget": {},
    "handleObj": {
      "type": "click",
      "origType": "click",
      "data": null,
      "guid": 62,
      "namespace": ""
    },
    "data": null
  },
  "ch": "0|s",
  "wr": true,
  "dt": "xml",
  "async": true,
  "rt": 0,
  "sp": "bubble",
  "sr": false
}
{code}
It should be noted that the bug does not occur when you tab out of the TextField first. With the focus change out of the way, the first button click directly works as expected.

Also, parent component AjaxFormComponentUpdatingBehavior does not seem to be affected by this bug.

 

  was:
I have a simple form with a TextField and an AjaxButton. The button is disabled initially and is being enabled after typing something in the TextField using an OnChangeAjaxBehavior (see attached quickstart). Enabling the button works as expected.

However, when clicking on the button after the OnChangeAjaxBehavior has fired, the first click is ignored. It is only after a second click on the button that the onSubmit() method is triggered.

Looking at the JS console, it seems that the first click triggers another "input change" event due to the focus change:
{code:json}
{
  "u": "./?3-1.0-form-input",
  "m": "POST",
  "c": "inputd",
  "e": [
    "input change"
  ],
  "event": {
    "originalEvent": {
      "isTrusted": true
    },
    "type": "change",
    "target": {},
    "currentTarget": {},
    "timeStamp": 4471,
    "jQuery360038239900837477336": true,
    "delegateTarget": {},
    "handleObj": {
      "type": "change",
      "origType": "change",
      "data": null,
      "guid": 4,
      "namespace": ""
    },
    "data": null
  },
  "ch": "0|s",
  "wr": true,
  "dt": "xml",
  "async": true,
  "rt": 0,
  "pd": false,
  "sp": "bubble",
  "sr": false
}
{code}
After that, the next click triggers the "click" event as expected:
{code:json}
{
  "u": "./?3-1.0-form-submit",
  "m": "POST",
  "c": "submit10",
  "f": "forme",
  "sc": "p::submit",
  "e": [
    "click"
  ],
  "pd": true,
  "event": {
    "originalEvent": {
      "isTrusted": true
    },
    "type": "click",
    "target": {},
    "currentTarget": {},
    "relatedTarget": null,
    "timeStamp": 28490,
    "jQuery360038239900837477336": true,
    "delegateTarget": {},
    "handleObj": {
      "type": "click",
      "origType": "click",
      "data": null,
      "guid": 62,
      "namespace": ""
    },
    "data": null
  },
  "ch": "0|s",
  "wr": true,
  "dt": "xml",
  "async": true,
  "rt": 0,
  "sp": "bubble",
  "sr": false
}
{code}
It should be noted that the bug does not occur when you tab out of the TextField first.

Also, parent component AjaxFormComponentUpdatingBehavior does not seem to be affected by this bug.

 


> OnChangeAjaxBehavior blocks first subsequent button click
> ---------------------------------------------------------
>
>                 Key: WICKET-6997
>                 URL: https://issues.apache.org/jira/browse/WICKET-6997
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 9.11.0
>         Environment: - macOS 12.5.1 (intel)
> - Tomcat 8.5.82
> - OpenJDK Runtime Environment Temurin-11.0.16+8 (build 11.0.16+8)
> - Wicket 9.11.0
> - Firefox 103.0.2, Chrome 104.0.5112.101
>            Reporter: Lars Mallinckrodt
>            Priority: Minor
>         Attachments: quickstart.zip
>
>
> I have a simple form with a TextField and an AjaxButton. The button is disabled initially and is being enabled after typing something in the TextField using an OnChangeAjaxBehavior (see attached quickstart). Enabling the button works as expected.
> However, when clicking on the button after the OnChangeAjaxBehavior has fired, the first click is ignored. It is only after a second click on the button that the onSubmit() method is triggered.
> Looking at the JS console, it seems that the first click triggers another "input change" event due to the focus change:
> {code:json}
> {
>   "u": "./?3-1.0-form-input",
>   "m": "POST",
>   "c": "inputd",
>   "e": [
>     "input change"
>   ],
>   "event": {
>     "originalEvent": {
>       "isTrusted": true
>     },
>     "type": "change",
>     "target": {},
>     "currentTarget": {},
>     "timeStamp": 4471,
>     "jQuery360038239900837477336": true,
>     "delegateTarget": {},
>     "handleObj": {
>       "type": "change",
>       "origType": "change",
>       "data": null,
>       "guid": 4,
>       "namespace": ""
>     },
>     "data": null
>   },
>   "ch": "0|s",
>   "wr": true,
>   "dt": "xml",
>   "async": true,
>   "rt": 0,
>   "pd": false,
>   "sp": "bubble",
>   "sr": false
> }
> {code}
> But the actual click event seems to be lost.
> After that, the next button click triggers the "click" event as expected:
> {code:json}
> {
>   "u": "./?3-1.0-form-submit",
>   "m": "POST",
>   "c": "submit10",
>   "f": "forme",
>   "sc": "p::submit",
>   "e": [
>     "click"
>   ],
>   "pd": true,
>   "event": {
>     "originalEvent": {
>       "isTrusted": true
>     },
>     "type": "click",
>     "target": {},
>     "currentTarget": {},
>     "relatedTarget": null,
>     "timeStamp": 28490,
>     "jQuery360038239900837477336": true,
>     "delegateTarget": {},
>     "handleObj": {
>       "type": "click",
>       "origType": "click",
>       "data": null,
>       "guid": 62,
>       "namespace": ""
>     },
>     "data": null
>   },
>   "ch": "0|s",
>   "wr": true,
>   "dt": "xml",
>   "async": true,
>   "rt": 0,
>   "sp": "bubble",
>   "sr": false
> }
> {code}
> It should be noted that the bug does not occur when you tab out of the TextField first. With the focus change out of the way, the first button click directly works as expected.
> Also, parent component AjaxFormComponentUpdatingBehavior does not seem to be affected by this bug.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)