February 25, 2020, 3:59pm
Hi, I have an application which recognizes which element is clicked by analyzing the unique element ID.
It worked fine in Hype 4 Pro 660 (and before).
But it does not work any more in Hype 4 Pro 664.
Is this a bug?
Or a feature? But what is the Unique Element ID good for, if it doesn’t belong the element anymore?
(sorry, I am not able to upload the project, because it contains too many things not for the public
Thank you for any hints!
how it looks in the Hype editor:
how the generated source looked in 660
how the generated source looks in 664
February 25, 2020, 4:33pm
testID.zip (12.3 KB)
February 25, 2020, 4:36pm
Could it be that you have this Unique Element ID assigned in two separate Responsive Layouts? In that case a collision would be detected and a generated ID would be used.
If you could create a simplified Hype document where we can see this is in action (without any private stuff) that would be . great.
February 25, 2020, 9:11pm
Thank you, Daniel. It was not another Layout, but the element is part of a symbol, and the symbol occurred several times in the project.
I rearranged the project, deleted everything I do not really need, and I got the symbol used exactly once - then it works without further problems.
But this kind of reduces the advantage of symbols. Is there no way I can use a symbol with the same unique IDs several times? I know that contradicts the notion of “unique ID”. But how do you do it otherwise?
Thank you for quick response. For me this case is solved, the above questions stay
February 25, 2020, 9:49pm
@MaxZieb did a good summary on this topic:
February 26, 2020, 12:52am
Thank you, Hans-Gerd!
The solution I came up with for the problem “which element was actually clicked?” goes like this:
Give the element in the Identity section an additional HTML Attribute. Example: “name” = “2-cardcloth” (for the element representing the second card cloth.
This solution works, too
February 26, 2020, 6:48am
this works as long as the hype-function is triggered by a click or touch-event on the element itsself!
More Info on Data-Attributes:
I use them all the time in Hype since version 4.x has allowed access to them and plead for a dedicated view for them. Here is a great article with two excerpts to get you into the mood to learn about data-attributes …
HTML elements can have attributes on them that are used for anything from accessibility information to stylistic control.
What is discouraged is making up your own attributes, or repurposing existing attributes for unrelated functionality. In the following ex
Read the fu…