Show the attachment button when a user clicks on a row in the child table

https://imgur.com/a/NeHxvjB

Video :arrow_up:
I want to open an Attachment popup when the user clicks on a Child table row.
or
On clicking the Add Row button, a new row with an Attach button should automatically appear.

I want to achieve one of the things I mentioned above to improve UX.

I manage to show the Attach button when the Add Row button is clicked with this code.

frappe.ui.form.on("Attachment", {
    attachments_add: (frm, cdt, cdn) => {
        let attachment = locals[cdt][cdn];
        $('div[data-idx="'+attachment.idx+'"].grid-row div[data-fieldname="attachment"]').click();
    }
});