You didn't include an example of exactly how you are using the <<button>> macro so I will include examples of both of it's main usages.
1. Using a <<button>> macro to move to another passage, optionally modifying story variables.
<<button "Hello" "Next Passage">>\
<<set $varA += 10, $varB += 10>>\
<</button>>
... in this particular use-case you could use a standard HTML button element combined with HTML Attributes. If you Inspect the HTML generated for the above <<button>> macro you would see something like the following
<button data-passage="Next Passage" class="link-internal macro-button" type="button" tabindex="0">Hello</button>
... so to manually create a Farewell equivalent that includes a title attribute you would do the following.
<button class="link-internal macro-button" data-passage="Next Passage" data-setter="$varA += 10, $varB += 10" title="The Farewell button">Farewell</button>
2. Using a <<button>> macro to modify the contents of the current passage.
<<button "Open">>\
/% code to do something, from setting variables to executing other macros. %/
<</button>>
This particular use-case is a little more difficult because you want to add more complex behaviour and there are currently no HTML Attributes for doing that. I believe this use-case needs to broken down into two sub units:
2a. Uniquely identifying the button element to modify.
As you saw in point 1's second example (of the HTML generated for the macro) the button element does not contain any unique properties, which means you need some other means to do this. One possible solution is to wrap each button element within an uniquely identifying span element.
@@#open;<<button "Open">>\
/% code to do something, from setting variables to executing other macros. %/
<</button>>@@
@@#close;<<button "Close">>\
/% code to do something, from setting variables to executing other macros. %/
<</button>>@@
2b. Using Javascript to add a title attribute to each button element.
You need to wait until after the span & button elements have actually been created (during the Passage rendering process) before you can access and modify them, one way to do this is to use a single-use postrender task function. You can create one of these by adding code like the following to the end of the Passage that contains the above <<button>> macros.
<<script>>
postrender["Add Button Titles"] = function (content, taskName) {
delete postrender[taskName]; // single-use task.
var me = $(content);
me.find("#open button").attr("title", "The Open button");
me.find("#close button").attr("title", "The Close button");
};
<</script>>
The above creates the "Add Button Titles" postrender task which deletes itself the first time it is run, the task also finds each of the newly created button elements within the supplied content object and updates their titles. Sometime after this task is executed the HTML structure within the content object will be injected into the current HTML page.