Replies: 3 comments 1 reply
-
I agree. I think there is no reason to add and ID to all the elements. I would only add the ID if (for some reason) we need to identify the element. And, as you said, CSS should not be a reason anymore. The main reason for having IDs in Agama is integration testing. So, as a general rule, I would add an ID to all clickable elements. |
Beta Was this translation helpful? Give feedback.
-
And about naming pattern, what about something like this?
|
Beta Was this translation helpful? Give feedback.
-
I'm going to keep this closed by now. We're in the middle of UI reorganization after remaking it almost form scratch. We' can revisit this topic later. |
Beta Was this translation helpful? Give feedback.
-
Some time ago, we were asked by
@qe-yam
team to use the HTMLid
attribute for each element in HTML DOM element that they need to handleI had a short chat with @imobachgs about it and checked that all Agama form elements have unique identifiers. Thus, we asked them to tell us what other nodes they need to be identified to take a look and, somehow, define a guide/rule to follow.
However, it was pending to reason about why not put the
id
attribute everywhere.Unless I'm wrong, there is no technical or performance problem with using the
id
whenever is needed. I found neither, browser limitations nor strong recommendations in the documentation. The only rule is to respect its uniqueness, which can be a bit challenging if we start using it indiscriminately.Aside from rules and/or challenges, some of us are (or were) against relaying more than needed in such an attribute because we are a bit old-school and we were there when people used to use an
id
for CSS fixes because it usually wins due to its weight in the specificity algorithm.Slightly related to this, note that we also avoid using the data-testid attribute when writing test for the components. But here we're just following the React Testing Library recommendation.
With all this in mind, I think we should define our own rules to know when we should use an
id
. We can start with something simple and reevaluate it when new and justified needs arise. Thus, my initial proposal would be to use them in@qe-yem
team)Ideally, we should try to define a naming pattern too.
Please, comment below. I'm eager to read your ideas on this topic.
Related to https://suse.slack.com/archives/C02TLF25571/p1694591663458129 (internal link)
Beta Was this translation helpful? Give feedback.
All reactions