Search code examples
javajavascriptjsfrichfaces

rich:autocomplete needs two clicks to hide popup


In Internet Explorer 9 when an autocomplete popup is opened by clicking on the arrow button, it needs two clicks outside it to close it.

This can be reproduced with the following code:

<f:view>
    <h:head></h:head>
    <h:body>
        <rich:autocomplete mode="client" minChars="0" autofill="false" showButton="true"
            autocompleteList="#{fn:split('Test 1, Test 2, Test 3', ',')}" />
    </h:body>
</f:view>

The problem is, that the handler for the blur event is not fired for the first click.

It seems to be a bug in RichFaces, so I filed a bug report. As I don't think it will be fixed very soon and I can't upgrade to a newer version, I am looking for a workaround.


Solution

  • It works when I add the following code to my page:

    jQuery(document).ready(function () {
        jQuery('.rf-au-fld-btn').click(function(e) {
            jQuery(e.target).focus();
        }); 
    });