# Identifying SVG elements

**URL:** <https://talk.observablehq.com/t/identifying-svg-elements/9160>\
**Category:** Help\
**Created:** [April 18, 2024, 2:50pm UTC](https://talk.observablehq.com/t/identifying-svg-elements/9160 "2024-04-18T14:50:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lieblb](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@lieblb](https://talk.observablehq.com/u/lieblb)\
**Post date:** [April 18, 2024, 2:50pm UTC](https://talk.observablehq.com/t/identifying-svg-elements/9160/1 "2024-04-18T14:50:59Z")

</div>

Hello, I’m new to observable plot, and am trying to figure out a good way to give SVG elements created by Plot.plot a unique label so I can find them later through e.g. d3.

As a hack, currently, I’m trying to give `Plot.ruleX` an `ariaLabel` and even though this turns up in the `MarkOptions`, the generated SVG group and line don’t have them. So, this does NOT work:

`rule = Plot.ruleX(..., {ariaLabel: "abc"})`

However, setting the object later, does work (but it’s really hacky, as this attribute is not in the documented types):

```auto
rule = Plot.ruleX(...)
rule.ariaLabel = "abc"

```

So, I’m now wondering if there is any official and supported way to do something similar.

---

<div class="post-metadata">

**Author:** ![Fil](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/fil/32/207_2.png) [@Fil](https://talk.observablehq.com/u/Fil)\
**Post date:** [April 18, 2024, 4:34pm UTC](https://talk.observablehq.com/t/identifying-svg-elements/9160/2 "2024-04-18T16:34:15Z")

</div>

You could try **ariaDescription** instead. (And there are yet other ways, if this doesn’t work for your use case.)

---

<div class="post-metadata">

**Author:** ![lieblb](https://avatars.discourse-cdn.com/v4/letter/l/f1d935/32.png) [@lieblb](https://talk.observablehq.com/u/lieblb)\
**Post date:** [April 19, 2024, 1:24pm UTC](https://talk.observablehq.com/t/identifying-svg-elements/9160/3 "2024-04-19T13:24:48Z")

</div>

Hi @Fil, thank you for your answer, I learned this seems to be an ongoing discussion. I saw you proposed a className option on github ([className option for marks · Issue #1002 · observablehq/plot · GitHub](https://github.com/observablehq/plot/issues/1002)) and I also saw the discussion about adding data attributes ([Add possibility to include a data attribute to text element. by lotusjohn · Pull Request #1841 · observablehq/plot · GitHub](https://github.com/observablehq/plot/pull/1841)). I am kind of surprised that aria attributes are the workaround right now.
