Using AUISelect2 closes quickedit in Service Desk project

When using auiSelect2 in a custom field, opening the select-overlay will close the quickedit-selection. This behavior happens only in Service Desk Projects, software projects work just fine.

The Velocity-Template used to create the edit-view of the custom field is also attached as a minimal sample.
The behavior does not appear when using the regular edit issue screen.screencast

The following minimal example for a customfield editing-template causes the problem to happen for me:

#customControlHeader($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams)
    <select name="${customField.id}:${insightFieldKey}" id="select-input-id"
           class="select-input"
            value="1">
        <option value="1">example 1</option>
        <option value="2">example 2</option>
    </select>

    <script>
        AJS.toInit(function () {
            #set($d = "$")
            AJS.$("#select-input-id").auiSelect2()
        });

    </script>
#customControlFooter($action $customField.id $fieldLayoutItem.fieldDescription $displayParameters $auiparams)

Has anyone experienced this issue before, maybe found a way around it?

Cheers,
Leo

Hi @Leo1,

Iā€™ve raised this issue as [AUI-5357] - Ecosystem Jira. Thanks for the detailed explanation of the problem! Iā€™m not sure what the cause is at this stage, so Iā€™ll investigate and get back to you once I know more.

In the meantime, could you let me know the version(s) of Jira and Jira Service Desk you are using? It would also help if you could check what version of AUI is present on those pages. You can check the AUI version by inspecting the <body> tag and checking the value of the data-aui-version attribute.

Cheers,
Daz

Hi @daz,
thank you for the help, I will keep an eye on this ticket.
Jira is version 8.13.0, JSD is 4.13.0. I will try and update those to the newest version and see if the error persists. AUI is version 9.1.0.

Another thing that i noticed: If i set the AUISelect2 to accept multiple values, quickedit only closes after actually selecting one value. No idea if that means anything.

Edit: I have confirmed that this also happens with Jira 8.16.0, JSD 4.16 and AUI 9.1.4.

Cheers,
Leo

Hi @Leo1, I have a small update for you.

After the team investigated the problem, they determined the cause is in Jira and the ā€œblur triggerā€ logic for inline edit. Jiraā€™s inline edit capability has pluggable behaviour for what to do when the custom field is blurred. Using this, you can alter when Jira considers the inline edit to be finished ā€“ such as listening to the change event of your select2 component, or some other user behaviour.

The default blur trigger in Jira will finish an inline edit whenever an input element inside its DOM is blurred.

The select2 component renders DOM elements outside of the inline edit fieldā€™s DOM, which makes the default blur trigger inappropriate for the field.

Hereā€™s the mystery: by default, the default blur trigger should not be enabled for custom fields; it should be up to you to either opt-in to the default blur trigger or specify your own. However, it seems this default blur trigger is getting used on the JSD issue screen.

For this reason, weā€™re forwarding the bug on to the JSD team to investigate why this default blur trigger is getting used.

In the meantime, try creating a custom blur trigger for your custom field that does not cancel the edit on blur. Weā€™re hopeful that will resolve the issue for you; let us know how it goes!

Hope that helps,
Daz

1 Like

Hi @Leo1,

Unfortunately, this is caused by an existing bug in JSDā€™s frontend logic.
Could you please kindly ā€˜Watchā€™ this ticket [JSDSERVER-5777] JSD Javascript disbale Inline Edit for Select 2 field - Create and track feature requests for Atlassian products. and indicate ā€˜This affects my teamā€™ in it? That way, we can prioritize a fix for this bug.

Thank you

Martin
Jira Service Management

Hi @daz, hi @mma

Thank you for your replies. I am watching and following the linked ticket and will implement the suggested workaround next time i touch the plugin in question. I will let you know then!

Best regards,
Leo