Skip to content

Is it intentional that Textual DOMNode IDs aren't required to be unique? #1044

Answered by willmcgugan
davep asked this question in Q&A
Discussion options

You must be logged in to vote

I'm taking my lead from the browser, which doesn't enforce uniqueness of IDs. Although we do deviate where appropriate, so it is a good discussion to have.

My gut feeling is that enforcing IDs as globally unique may not improve the user experience. I can think of no reason why Textual would need unique IDs, so I'd be reluctant to force that on the the dev. And its actually quite difficult to coordinate, when you have a "page" assembled from multiple components.

So I suspect uniqueness should be a SHOULD, and not a MUST.

A compromise might be we enforce uniqueness within a single component's children. Since a component could manage that quite easily, and a duplicate ID has a high chance of…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@davep
Comment options

@willmcgugan
Comment options

@davep
Comment options

Answer selected by davep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants