•  
      request #20569 Submit buttons does not appear in some cases in new followup comment
    Infos
    #20569
    Joris MASSON (jmasson)
    2021-03-31 15:29
    2021-03-31 15:29
    22156
    Details
    Submit buttons does not appear in some cases in new followup comment

    Reproduction scenario

    1. Edit an existing artifact
    2. Go to the new follow-up comment edition area
    3. Do not write anything in the textarea. Switch the "format" selectbox from Markdown to HTML twice
    4. The "Submit" button does not appear the second time

    Workarounds

    • Enter some content in the textarea first. It makes the "Submit" button appear
    • Open any field in edition (without changing anything). It makes the "Submit" button appear

    Technical details

    The appearance of the "Submit" button is controller by TrackerArtifactEditionSwitcher.js which is written in Prototype.js. It adds an event listener on the "change" event of the "format" selectbox. Since story #18337 markdown replace text, this selectbox is rendered in a dynamic way by lit-html because it needs to be disabled while the "Preview" HTML is loading. A side-effect of this is that the DOM Element is re-created when changing the format, which kills the external listeners registered on it. This means that when you change the format, TrackerArtifactEditionSwitcher.js is no longer informed that it needs to do something.

    Fixing this bug will require a refactoring of this part of TrackerArtifactEditionSwitcher.js as it now needs to register a "format changed callback" into the New follow-up comment rich-text-editor instance in order to handle this situation. It cannot keep querying some magic string ID in the DOM and bind a listener to it.

    Trackers
    12.6
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    Verified
    Empty
    Attachments
    Empty
    References
    Referenced by request #20569