W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

Re: set input.value when input element has composition string

From: Kang-Hao (Kenny) Lu <kennyluck@w3.org>
Date: Mon, 28 Feb 2011 21:31:15 +0900
Message-ID: <4D6B9593.6020602@w3.org>
To: Makoto Kato <m_kato@ga2.so-net.ne.jp>
CC: WHAT Working Group <whatwg@whatwg.org>, WWW International <www-international@w3.org>, WebApps Working Group <public-webapps@w3.org>
Hello Makoto,
(Cc+ public-webapps)

(11/02/25 15:16), Makoto Kato wrote:
> Hi,
> This is simple sample.  This behavior is different on all web browsers
> when input element has composition/preedit string for IME.

A relevant question here, I think, is where the cursor should go when
the value of the text box is set by script. For Safari5, it always goes
to the end when the value is set. For FF4.0b11, the cursor stays in
previous position when the value to be set is the same and goes to the
end when the value is different. Is this a known incompatibility? I find
the behavior of FF quite strange.

> If input element has composition string by IME, should it cancel
> composition string and set value by script?  Or should it cancel
> setting value since it has composition string?

What makes sense to me is:
1. the cursor always goes to the end
2. the composition string goes with the cursor, which should not change.

But I am not sure whether this is the right way to go.

> <script>
> function setvalue() {
>   document.getElementById('test').value = "replaced";
> }
> </script>
> <body onload="setTimeout('setvalue()',5000)">
> <input type="text" id="test"/>
> </body>
> -- Makoto Kato
Received on Monday, 28 February 2011 12:30:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:16 UTC