Chat live region implementation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Chat live region implementation

Peter Parente
I have a novice question about live regions as applied to real-time
chat conversations. In the chat clients that support (or will support)
live regions (e.g., Chatzilla). I'm assuming that separate DOM nodes
are used to encapsulate individual messages such that the politeness
attribute can be set on a message by message basis. Is this correct?

If this is true, does anyone have an idea of how many other chat-like
Web apps follow this "messages are separate nodes" design, without
having considered live regions? From a naive perspective, chat looks
like text getting inserted into a single node. As far as I can tell,
politeness cannot be set on a per text insertion basis, only on
separate DOM nodes. Is this a problem for apps that do plain text
insertions? Do they have to "convert" to using separate DOM nodes?

If I'm saying something silly, forgive me. I'm no web app expert.

Thanks,
Pete

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Chat live region implementation

Gijs Kruitbosch ("Hannibal")
Peter Parente wrote:

> I have a novice question about live regions as applied to real-time
> chat conversations. In the chat clients that support (or will support)
> live regions (e.g., Chatzilla). I'm assuming that separate DOM nodes
> are used to encapsulate individual messages such that the politeness
> attribute can be set on a message by message basis. Is this correct?
>
> If this is true, does anyone have an idea of how many other chat-like
> Web apps follow this "messages are separate nodes" design, without
> having considered live regions? From a naive perspective, chat looks
> like text getting inserted into a single node. As far as I can tell,
> politeness cannot be set on a per text insertion basis, only on
> separate DOM nodes. Is this a problem for apps that do plain text
> insertions? Do they have to "convert" to using separate DOM nodes?
>
> If I'm saying something silly, forgive me. I'm no web app expert.
>
> Thanks,
> Pete
>

In the end there is no way to actually "append" something to a node -
you can set the contents to be something else but in essence what you're
doing is removing the old content and setting it to something else,
which just happens to be almost the same. This is different from a DOM
node insertion, where you don't touch any of the other DOM nodes.

What I'm trying to get at is that continuously modifying the properties
of a single node (by "inserting" plain text) is costly, and will
eventually start seeing a "flash" as the entire content of the node is
updated, while adding a DOM node to the end of a container DOM node is
somewhat more atomic (ie, you could leave existing content be).

I apologize for the fuzzy language - I'm no expert myself either, but
this is what I think about the subject.

Also note that it's not possible to do any markup on an arbitrary part
of text in a DOM node (not even a newline, either!) - in order to apply
markup, text needs to have its own DOM node. I therefor find it hard to
imagine any reasonable UI that doesn't use separate DOM nodes.

~ Gijs
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Chat live region implementation

Gijs Kruitbosch ("Hannibal")
In reply to this post by Peter Parente
Peter Parente wrote:

> I have a novice question about live regions as applied to real-time
> chat conversations. In the chat clients that support (or will support)
> live regions (e.g., Chatzilla). I'm assuming that separate DOM nodes
> are used to encapsulate individual messages such that the politeness
> attribute can be set on a message by message basis. Is this correct?
>
> If this is true, does anyone have an idea of how many other chat-like
> Web apps follow this "messages are separate nodes" design, without
> having considered live regions? From a naive perspective, chat looks
> like text getting inserted into a single node. As far as I can tell,
> politeness cannot be set on a per text insertion basis, only on
> separate DOM nodes. Is this a problem for apps that do plain text
> insertions? Do they have to "convert" to using separate DOM nodes?
>
> If I'm saying something silly, forgive me. I'm no web app expert.
>
> Thanks,
> Pete
>

Argh, missed your first question. Yes, that's correct - ChatZilla uses a
table and inserts a new row (<tr>) for each message - it does some more
complicated things (nested tables :-( ) for long nicknames which would
otherwise break the layout for sighted users. We would have liked to do
this differently, but the CSS properties we need to do that
unfortunately don't exist or aren't implemented.

~ Gijs
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Chat live region implementation

Tom Brunet
In reply to this post by Peter Parente
> politeness cannot be set on a per text insertion basis, only on
> separate DOM nodes. Is this a problem for apps that do plain text
> insertions? Do they have to "convert" to using separate DOM nodes?

Yes, this could be a problem, and yes, they would have to convert.

Consider the following HTML:

<DIV id='chat'>
<SPAN class='name'>Peter:</SPAN> Hello. <BR>
<SPAN class='name'>Tom:</SPAN> Hello. <BR>
</DIV>

Although the two Hello's are in different text nodes, attributes cannot
be added to text nodes.  Therefore, the polite attributes have to be
added to the parent nodes.  Since both text nodes have the same parent
(the DIV node), I cannot apply politeness at a message by message basis.

However, this isn't difficult to convert.  You can just wrap the content
of interest in a SPAN:

<DIV id='chat'>
<SPAN><SPAN class='name'>Peter:</SPAN> Hello. </SPAN><BR>
<SPAN><SPAN class='name'>Tom:</SPAN> Hello. </SPAN><BR>
</DIV>

Now, each message has a unique parent.  Better designs probably wouldn't
have these sorts of problems though.

Tom
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Chat live region implementation

Peter Parente
Thanks for the explanation, Gijs and Tom.

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility