readonly

readonly

フォーム制御子系要素 readonly 属性 (HTML, XHTML 1)

[2] HTML のフォーム制御子系要素の readonly 属性は、 その制御子の変更を禁じます。

[10]

状態
W3C 勧告WHATWG WD
要素型
input, textarea
type
text, password, email, url, date, datetime, datetime-local, month, week, time, number, textarea
属性名
readonly (read‐only (読取専用) より)
属性値
ブール型属性 (>>4)
既定値
(>>4)

[3] 仕様書:

属性値

[4] この属性は真偽値属性です。指定すれば真 (読取専用)、 省略すれば偽 (読書可能) です。

[9] HTML 4 DTD の注釈 (参考) には for text and passwd と説明があります。

UA による利用

[5] 読取専用の要素は、

  • 焦点を受取ります。 HTML 4 17.12.2
  • 利用者が編集することはできません。HTML 4 17.12.2
  • タブ navigation (tabindex を参照。) に含まれます。 HTML 4 17.12.2
  • 成功し得ます。 HTML 4 17.12.2
  • レンダリングは UA 依存です。 HTML 4 17.12.2

アクセス可能性・可用性・安全性

[8] この属性は HTML 的手段で動的に編集できません (>>6) から、 アクセス可能性に関して disabled 属性と同じ問題を抱えています。

歴史

[11] HTML 4 では type に関する規定はありませんでしたが、 Web Forms 2.0 は適用対象を明記しています。 ボタン系の widget には読取専用の概念はありません WF2 2.5

関連

[6] 制御子が読取専用であるかどうかを、 HTML 的に動的に編集する方法はありません。 動的に変更する場合はスクリプトを使うことになります。 HTML 4 17.12.2

[7] 似た属性として、 disabled があります。 こちらは成功しないなどより強い制約を受けます。 disabledselect などより多くの要素に指定できます。

メモ

[1] 2004-03-06 11:53:47 +00:00 名無しさん: Request clarification: Does readonly apply to checkboxes and radio buttons? from Robin Lionheart on 2004-02-19 (www-html@w3.org from February 2004) <http://lists.w3.org/Archives/Public/www-html/2004Feb/0100.html>

[14] [whatwg] Can we make checkboxes readonly? ( 版) <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-April/031137.html>

:read-only 擬似クラス、 :read-write 擬似クラス

仕様書

意味

HTML

[30] :read-write は次の要素一致しなければなりません >>26

[34] :read-only はそれ以外のすべてのHTML要素一致しなければなりません >>26

XForms

[16] XForms では :read-only:read-write はそれぞれ readonly モデル項目特性節点束縛されたフォーム制御子を表します。

歴史

CSS UI

[20] XForms での利用を想定して >>19 で追加されました。

[22] XForms には >>21 で追加されました。

Web Controls 1.0

[24] :read-only, :read-write, :write-onlyWebアプリケーションから自由に設定できるようにする構想がありました。

HTML

[29] HTML についてははじめ Web Forms 2.0 が、後に Web Applications 1.0 が規定しています。

[36] [whatwg] Can we make checkboxes readonly? ( ( 版)) <http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/035646.html>

[37] Web Applications 1.0 r7365 Clarify things around readonly=, add more variety to the way boolean attributes are used in examples.]] ( ( 版)) <http://html5.org/tools/web-apps-tracker?from=7364&to=7365>

[38] Web Applications 1.0 r2778 Defined how pseudo-classes match HTML concepts. Redid how rtl/ltr changes are marked. Stopped <legend> centering for <figure>. Removed <multicol> support. Removed <basefont> support. Removed obsolete notes. Fixed minor typos. ( ( 版)) <http://html5.org/r/2778>

[39] csswg: changeset 14966:d176479b88ff ( ( 版)) <https://dvcs.w3.org/hg/csswg/rev/d176479b88ffe2dcfa027be6aee807afc0d45bd2>

[12] Re: [css-ui][selectors] Definition of :read-only ( (Chris Rebert著, )) <https://lists.w3.org/Archives/Public/www-style/2016May/0070.html>

[13] 17812 – :read-write should always apply to input elements if @readonly doesn't apply ( ()) <https://www.w3.org/Bugs/Public/show_bug.cgi?id=17812>

[40] [css-ui][selectors] Definition of :read-only ( (Simon Pieters著, )) <https://lists.w3.org/Archives/Public/www-style/2016Apr/0294.html>

[41] Issue 255351 - chromium - :read-write pseudo-class isn't applied on <input type="text" disabled> - Monorail ( ()) <https://bugs.chromium.org/p/chromium/issues/detail?id=255351>