html id and transclusion

92 views
Skip to first unread message

Jean-Pierre Rivière

unread,
Apr 28, 2021, 6:13:54 AM4/28/21
to TiddlyWiki
In a recent thread, Jeremy told me that having id elements is a bit of a problem because each tiddler can be transcluded more than once into any given tiddler' which would result into a broken html with a repeated id value.

This is true.

But if id are required, shouldn't it be up to the programmer to make sure there is no problem? Of course, the doc would tell that specifying id is a tricky things to be done with great precaution. But this is IMHO better that forbidding id specification altogether.

As was the exposed, this has to do with WCAG requirements ignoring the CORRECT HTML (stated as accessible on official docs) <label><input/></label> are requiring <label for=foo/><input id=foo/> as the only validating way of accessible code. (with some variations for WAI-ARIA)

-- 
Jean-Pierre

Jeremy Ruston

unread,
Apr 28, 2021, 6:32:33 AM4/28/21
to tiddl...@googlegroups.com
In a recent thread, Jeremy told me that having id elements is a bit of a problem because each tiddler can be transcluded more than once into any given tiddler' which would result into a broken html with a repeated id value.

This is true.

But if id are required, shouldn't it be up to the programmer to make sure there is no problem? Of course, the doc would tell that specifying id is a tricky things to be done with great precaution. But this is IMHO better that forbidding id specification altogether.

As was the exposed, this has to do with WCAG requirements ignoring the CORRECT HTML (stated as accessible on official docs) <label><input/></label> are requiring <label for=foo/><input id=foo/> as the only validating way of accessible code. (with some variations for WAI-ARIA)

Just to be clear, the core doesn't forbid using "id" attributes, it's perfectly possible to use them as long as care is taken. The thing that's particularly hard is to use IDs within a reusable component without the user of that component being aware of the mechanism. So, the core avoids the complexity of these techniques.

Best wishes

Jeremy.





-- 
Jean-Pierre

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d739e00f-ba01-4425-b0d0-9730d6524986n%40googlegroups.com.

Jean-Pierre Rivière

unread,
Apr 28, 2021, 10:48:15 AM4/28/21
to TiddlyWiki
Thank you for the clarification. I understand your point of view.

Now if I want to have a go at it, for instance so that my input buttons can get an id from a parameter, how should I proceed? From where should I start? I'm sure this is not trivial but I'm eager to try.

regards.

Jeremy Ruston

unread,
Apr 28, 2021, 11:34:14 AM4/28/21
to tiddl...@googlegroups.com
Hi Jean-Pierre

On 28 Apr 2021, at 15:48, Jean-Pierre Rivière <jn.pierr...@gmail.com> wrote:

Thank you for the clarification. I understand your point of view.

Now if I want to have a go at it, for instance so that my input buttons can get an id from a parameter, how should I proceed? From where should I start? I'm sure this is not trivial but I'm eager to try.

It’s essentially the same problem as we encounter when generating unique state tiddler titles. Thus you could use the <<qualify>> macro like so:

<label for=<<qualify id>>>This is the label</label>
<input id=<<qualify id>>/>

The qualify macro returns its argument with a string of numbers appended that is derived from the ancestor transclusions, making an ID that will be unique within a transclusion.

Best wishes

Jeremy


regards.

Le mercredi 28 avril 2021 à 12:32:33 UTC+2, jeremy...@gmail.com a écrit :
In a recent thread, Jeremy told me that having id elements is a bit of a problem because each tiddler can be transcluded more than once into any given tiddler' which would result into a broken html with a repeated id value.

This is true.

But if id are required, shouldn't it be up to the programmer to make sure there is no problem? Of course, the doc would tell that specifying id is a tricky things to be done with great precaution. But this is IMHO better that forbidding id specification altogether.

As was the exposed, this has to do with WCAG requirements ignoring the CORRECT HTML (stated as accessible on official docs) <label><input/></label> are requiring <label for=foo/><input id=foo/> as the only validating way of accessible code. (with some variations for WAI-ARIA)

Just to be clear, the core doesn't forbid using "id" attributes, it's perfectly possible to use them as long as care is taken. The thing that's particularly hard is to use IDs within a reusable component without the user of that component being aware of the mechanism. So, the core avoids the complexity of these techniques.

Best wishes

Jeremy.





-- 
Jean-Pierre

-- 
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d739e00f-ba01-4425-b0d0-9730d6524986n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

Jean-Pierre Rivière

unread,
Apr 28, 2021, 2:50:39 PM4/28/21
to TiddlyWiki
<label for=<<qualify id>>>This is the label</label>
<input id=<<qualify id>>/>

This is hand-made html code. how would I be able to get the input behave in tiddlywiki as if it was done by the button widget?

could a pragma like \useIdInButtons be used to allow a code like <$button actions=<<myMacro>> id=auto/> which would construct an input with an id=<<qualify id>>? No other value than "auto" would be allowed for "id", making uniformed use of it fail and force coders to look at the doc?

Jeremy Ruston

unread,
Apr 28, 2021, 3:09:24 PM4/28/21
to tiddl...@googlegroups.com
Hi Jean-Pierre

I think you’re asking why the IDs can’t be handled automatically, without the author having to worry about them. I think that that may be possible in simple cases, but not in general. Typically one needs the same ID in multiple places, which won’t happen just by using the qualify macro. It’s only the simple cases where the two elements are adjacent within the same transclusion that one can get away with using the qualify macro without needing to think about what is actually going on.

So, to summarise:

* Yes, we can use IDs in TiddlyWiki, and we have extensive infrastructure that can be used to simplify the job, but using those features requires an understanding of what is going on. One may be able to package simple cases like a label/input pair into a reusable macro, but it’s not possible to encapsulate the complexity in general
* If you want to explore using IDs, it would be worth looking at the infrastructure we have for dealing with qualified state tiddler titles

Meanwhile, the frustrating thing remains that all of this is only necessary because the WCAG spec ignores the underlying HTML spec (and the implementations of browsers and screen readers).

Best wishes

Jeremy.



Jeremy Ruston

unread,
Apr 29, 2021, 3:19:03 AM4/29/21
to tiddl...@googlegroups.com
Last night I came across a post that explains the history of the situation:


Thus, if I'm understanding correctly, the WCAG standard requires the "for" attribute because neither Internet Explorer 11 nor Dragon Dictate supports nested labels. That makes a lot of sense.

Best wishes

Jeremy


On 28 Apr 2021, at 20:09, Jeremy Ruston <jeremy...@gmail.com> wrote:

Hi Jean-Pierre

Jean-Pierre Rivière

unread,
Apr 29, 2021, 5:53:46 AM4/29/21
to TiddlyWiki

Since Dragon is now owned by Microsoft which has dumped IE for edge, maybe one of these days Dragon will understand the nested construct. Maybe... this discussion was from 2019 when Microsoft was already the new owner of Dragon.

Waiting can be the best solution for us. :-)

as for your counsel about looking for "looking at the infrastructure we have for dealing with qualified state tiddler titles", can you be a little bit more specific please? It's not evident to see what you mean.

PMario

unread,
Apr 29, 2021, 6:03:14 AM4/29/21
to TiddlyWiki
Reply all
Reply to author
Forward
0 new messages