Problem with hooks not appearing unless background is clicked

Hi All

I am trying to create a glossary for my game (using most recent version of Harlowe)

At the top of the glossary passage I have the following A-Z hooks, with a space for output underneath:

[A]<a| [B]<b| etc
|textoutput>[]
(click: ?a)[(replace: ?textoutput)[[[apple->glossaryapple]]]]

The code above works fine, however, if I add another item to the glossary under the letter A, there is a problem.

with the following:

(click: ?a)[(replace: ?textoutput)[[[apple->glossaryapple]]<br>[[aardvark->glossaryaardvark]]]]

Nothing happens when I click A initally. I have to click again on the blank page and then the links appear. Could anyone explain where I am going wrong? I have also tried creating an array with the necessary links and come up against the same issue.

It helps if you state the exact version of the story format you are using as answers can vary based on this information. I will assume you are using the Twine v2.3.5 application which comes with Harlowe v3.1.0 installed.

I added the following code example to a new Harlowe v3.1.0 based project…

[A]<a| [B]<b| etc
|textoutput>[]
(click: ?a)[(replace: ?textoutput)[[[apple->glossaryapple]]<br>[[aardvark->glossaryaardvark]]]]

…then tested the generated story HTML file within Chrome on Windows 10 and didn’t have the issue you described.

Which web-browser (brand, version, 32/64bit) did you use the test your code? And which Operating System (brand, version, edition, 32/64bit) were you running it on?

note: Due to how the (click:) family of macros are implemented it is generally advised that you use one of the (link:) family of macros instead whenever possible. The following is a variation of your code that uses the (link-repeat: ) macro to achieve a similar result.

{
(link-repeat: "A")[(replace: ?textoutput)[ [[apple->glossaryapple]]<br>[[aardvark->glossaryaardvark]]]]
(link-repeat: "B")[(replace: ?textoutput)[...]]
etc
}
|textoutput>[]

Without an example of your “array” based code it is difficult to determine why it didn’t work as you expected.