1. 序論
1.1. 概観
~UI~Eventsは、 ~~主に二つの目標を念頭に設計されている。 第一の目標は、 `~event$~systemを[ `~event~listener$の登録を許容する ]よう, および[ ~event~flowを~tree構造を通して述べる ]ように設計することである。 加えて,この仕様は、 ~UI~controlや文書の変異† — これら各~event~module用に定義済みな文脈l情報を含む — を通知するための,~eventの標準的な~moduleを供する。 ◎ UI Events is designed with two main goals. The first goal is the design of an event system which allows registration of event listeners and describes event flow through a tree structure. Additionally, the specification will provide standard modules of events for user interface control and document mutation notifications, including defined contextual information for each of these event modules.
【† 変異~event~API( `MutationEvent^I )は、 `非推奨に$され(今や,この仕様からも除去され), `DOM$r により `MutationObserver$I として定義し直された。 】
~UI~Eventsの第二の目標は、 既存の~browserに利用されている,現在の~event~systemに共通な~~機能を供することである。 これには、 既存の[ ~script, 内容 ]との相互運用能を~~促進することが意図されている。 この目標には、 後方-互換性を全部的に満たすことは,期待されていない。 しかしながら,この仕様は、 アリな所では これを達成しようと試みる。 ◎ The second goal of UI Events is to provide a common subset of the current event systems used in existing browsers. This is intended to foster interoperability of existing scripts and content. It is not expected that this goal will be met with full backwards compatibility. However, the specification attempts to achieve this when possible.
1.1.1. ~mouse~event, ~wheel~event
この仕様を成していた[ § ~mouse~event, § ~wheel~event ]は、 `POINTEREVENTS4$r へ移動された。 ◎ The Mouse Events and Wheel Events section of this specification have been moved to the Pointer Events specification [pointerevents4].
1.2. 適合性
`ui-events-conformance^APX2. ~style上の規約
この仕様では、 次の表記が用いられる 【!`Proposed W3C Specification Conventions@http://www.w3.org/People/Schepers/spec-conventions.html$ に従う】: ◎ This specification follows the Proposed W3C Specification Conventions, with the following supplemental additions:
| 表記~例 | 意味 |
|---|---|
| `↓^cap, `=^cap, `Q^cap | ~UIkey上に印字される `~UIkey~cap@#key-legends$。 この表記は、 生成される `KeyboardEvent!I の `key$m, `code$m 値には関わらない,利用者~視点の~UIkeyを指すときに利用される。 |
| `ア^kGl, `~~漢字^kGl | 文字/文字~並びを表現している~glyph並び |
| `003D^U | ~Unicode文字 |
| `ArrowDown$kY, `=^kY, `q^kY, `Q^kY | ~UIkeyを押して生成される~UIkey値 (すなわち、 `KeyboardEvent^I の `key$m 値) の名前 |
| `ArrowDown$kC, `Equal$kC, `KeyQ$kC | 物理的な~UIkeyに結付けられた~UIkey~code (すなわち、 `KeyboardEvent^I の `code$m 値) の名前 |
加えて,この仕様における ある種の用語は、 特定0の意味で利用される。 語 “実装”は、 ~browser, 内容~著作~tool, その他,この仕様を実装する`~UA$を~~指す。 語 内容~作者は、 ~interface, ~method, 属性, ~event, その他,この仕様にて述べる他の特能を利用する~scriptや~codeを書いて,~Web~appを作る者を~~指す。 利用者とは,ある実装の下で それらの~Web~appを利用する者を~~指す。 ◎ In addition, certain terms are used in this specification with particular meanings. The term "implementation" applies to a browser, content authoring tool, or other user agent that implements this specification, while a content author is a person who writes script or code that takes advantage of the interfaces, methods, attributes, events, and other features described in this specification in order to make Web applications, and a user is the person who uses those Web applications in an implementation. ◎ And finally: • This is a note. • This is an open issue. • This is a warning. interface Example { // This is an IDL definition. }
3. 基本~event~interface
基本~event~interfaceは `DOM$r にて定義され,~UI~Eventsの基礎を成す。 実装は、 以下に挙げる基本~event~interfaceを常に~supportするモノトスル: ◎ The basic event interfaces defined in [DOM] are fundamental to UI Events. These basic event interfaces MUST always be supported by the implementation:
- `Event$I ~interface, および その[ 定数, ~method, 属性 ]のうち次に挙げるもの ⇒# `NONE$m `CAPTURING_PHASE$m, `AT_TARGET$m, `BUBBLING_PHASE$m, `type$m, `target$m, `currentTarget$m, `eventPhase$m, `bubbles$m, `cancelable$m, `composed$m, `timeStamp$m, `defaultPrevented$m, `isTrusted$m, `stopPropagation()$m, `stopImmediatePropagation()$m, `preventDefault()$m, `initEvent()$m ◎ The Event interface and its following constants, methods and attributes: • NONE constant • CAPTURING_PHASE constant • AT_TARGET constant • BUBBLING_PHASE constant • type attribute • target attribute • currentTarget attribute • eventPhase attribute • bubbles attribute • cancelable attribute • composed attribute • timeStamp attribute • defaultPrevented attribute • isTrusted attribute • stopPropagation() method • stopImmediatePropagation() method • preventDefault() method • initEvent() method
- `CustomEvent$I ~interface, および その ⇒# `initCustomEvent()$m ~method, `detail@~DOM4#dom-customevent-detail$m 属性 ◎ The CustomEvent interface and its following method and attribute: • initCustomEvent() method • detail attribute
- `EventTarget$I ~interface, および その~methodのうち次に挙げるもの ⇒# `addeventlistener()$m, `removeeventlistener()$m, `dispatchEvent()$m ◎ The EventTarget interface and its following methods: • addEventListener() method • removeEventListener() method • dispatchEvent() method
- `EventListener$I ~interface, および その `handleEvent()$m ~method ◎ The EventListener interface and its handleEvent() method
- `Document$I ~interfaceの `createEvent()$m ~method ◎ The Document interface’s createEvent() method
この仕様に定義される各種~event型【用の~interface】は、 これらの基本~interfaceいずれかから派性し,そのすべての[ 属性, ~method, 定数 ]を継承するモノトスル。 ◎ The event types defined in this specification derive from these basic interfaces, and MUST inherit all of the attributes, methods, and constants of the interfaces they derive from.
この仕様に述べる各種~interfaceの継承~構造を,次の図表に述べる: ◎ The following chart describes the inheritance structure of the interfaces described in this specification.
3.1. 各種~event型の~list
各~eventには、 `~event型^emと称される,ある型が結付けられ、 ~event~obj上の `type$m 属性にて可用にするモノトスル。 ~event型は `DOMString^c 型でなければナラナイ。 ◎ Each event MUST be associated with a type, called event type and available as the type attribute on the event object. The event type MUST be of type DOMString.
実装は、[ ~DOM~supportの~level/ 表示~用に利用される装置(例: ~screen)/ ヤリトリ用に利用される装置(例: ~mouse, ~keyboard, ~touch~screen, ~voice) ]に依存して,これらの~event型を生成し得る。 `XML$r や `HTML$r【!HTML5】 の応用に利用されるときは、 その言語の仕様は,~event型に結付けられる意味論と視野(特に,アリな`~target$)を制約し得る/してもヨイ。 [ それらの制約/この文書にて定義されない~event型 ]を見出すには、 利用される言語を定義している仕様を見よ。 ◎ Depending on the level of DOM support, or the devices used for display (e.g., screen) or interaction (e.g., mouse, keyboard, touch screen, or voice), these event types can be generated by the implementation. When used with an [XML] or [HTML5] application, the specifications of those languages MAY restrict the semantics and scope (in particular the possible event targets) associated with an event type. Refer to the specification defining the language used in order to find those restrictions or to find event types that are not defined in this document.
【 参考: `DOM Event Viewers@https://domeventviewer.com/$en にて、 この仕様に定義される各種~event型の挙動を試せる。 】
次の表tに,この仕様に述べる各種~event型の参考な要約を供する: ◎ The following table provides an informative summary of the event types described in this specification.
| ~event型 | 同期c? | 浮上-? | `~trusted$な~target | ~DOM~interface | 取消~可否 | `既定~動作$(空欄は動作なし) |
|---|---|---|---|---|---|---|
| `abort$et | あり | しない | `Window$I, `Element$I | `Event$I | 不可 | |
| `beforeinput$et | あり | する | `Element$I | `InputEvent$I | 可 | ~DOM要素を更新する ◎ Update the DOM element |
| `blur$et | あり | しない | `Window$I, `Element$I | `FocusEvent$I | 不可 | |
| `compositionstart$et | あり | する | `Element$I | `CompositionEvent$I | 可 | `~text組成~system$の候補~窓を示す ◎ Show a text composition system candidate window |
| `compositionupdate$et | あり | する | `Element$I | `CompositionEvent$I | 不可 | |
| `compositionend$et | あり | する | `Element$I | `CompositionEvent$I | 不可 | |
| `error$et | なし | しない | `Window$I, `Element$I | `Event$I | 不可 | |
| `focus$et | あり | しない | `Window$I, `Element$I | `FocusEvent$I | 不可 | |
| `focusin$et | あり | する | `Window$I, `Element$I | `FocusEvent$I | 不可 | |
| `focusout$et | あり | する | `Window$I, `Element$I | `FocusEvent$I | 不可 | |
| `input$et | あり | する | `Element$I | `InputEvent$I | 不可 | |
| `keydown$et | あり | する | `Element$I | `KeyboardEvent$I | 可 | 文脈依存 — 次に挙げるいずれかを誘発する ⇒# `beforeinput$et, `input$et ~event/ `~text組成~system$を立上げる/ `blur$et, `focus$et ~event/ `keypress$et ~event(~supportされるならば)/ `作動化の挙動$/ その他の~event ◎ Varies: trigger beforeinput and input events; launch text composition system; blur and focus events; keypress event (if supported); activation behavior; other events |
| `keyup$et | あり | する | `Element$I | `KeyboardEvent$I | 可 | |
| `load$et | なし | しない | `Window$I, `Document$I, `Element$I | `Event$I | 不可 | |
| `select$et | あり | する | `Event$I | 不可 | ||
| `unload$et | あり | しない | `Window$I, `Document$I, `Element$I | `Event$I | 不可 |
この仕様にて非推奨にされた~eventたちが成す~listは、 `§ 旧来の~event型@~UIEVENTS-A#legacy-event-types$ を見よ。 ◎ For a list of events which are deprecated in this specification, see the Legacy Event Types appendix at the end of this document.
上の表tを解釈する仕方の一つは: `load$et ~eventは、[ その~event用に `Element$I ~nodeに付された`~event~listener$ ]を[ `捕捉-相$, `~target相$ ]にて誘発することになる。 この~eventは`取消~可能$でない。 `load$et ~event用の`~event~listener$は、[ `Window$I, `Document$I, `Element$I ]以外の~nodeに付されても,`浮上-相$のみに付されても誘発されない。 ◎ The following is one way to interpret the above tables: the load event will trigger event listeners attached on Element nodes for that event and on the capture and target phases. This event is not cancelable. If an event listener for the load event is attached to a node other than Window, Document, or Element nodes, or if it is attached to the bubbling phase only, this event listener would not be triggered.
注記: 上の表tを そこに挙げられた~event型~用に確たるものとして解釈しないこと。 例えば `load$et ~eventは、 `XMLHttpRequest$I などの他の仕様にも利用される。 同様に,`~trusted$でない~eventは、 `EventTarget$I も実装するどの~objにも,それ用の~listenerへ `dispatchEvent()$m を利用して配送できる。 ◎ Don’t interpret the above tables as definitive for the listed event types. For example, the load event is used in other specifications, for example, in XMLHttpRequest. Similarly, dispatchEvent() can be used to dispatch untrusted events to listeners on any object that also implements EventTarget.
注記: 上に述べた各~event型に結付けられる~event~objは、 追加的な文脈~情報を包含する — 更なる情報は、 ~DOM~interfaceの記述を見よ。 ◎ The event objects associated with the event types described above contain additional context information--refer to the description of the DOM interfaces for further information.
~event定義~表t
【 この節は、 この訳による補完。 】
この仕様に現れる,各種`~event型$の定義は、 次のような表tとして与えられる:
◎イ型 この欄には、 当の~event型の名前が記される (例: `click^et )。 この名前が、 ~eventの `type$m 属性の値になる。 ◎界面 この欄には、 この型の~event~objが実装する~interfaceが示される (例: `KeyboardEvent$I )。 ◎同期 この欄には、 この型の~eventが他の~eventと同期的に生じ得るならば “あり”/ 他の場合は “なし” と記される。 ◎浮上 この欄には、 この型の~eventが `浮上-$するならば “する” / 他の場合は “しない” と記される。 ◎標的 この欄には、 この型の~eventの`~target$になり得る~objが挙げられる (例: `Element$I )。 ◎取消 この欄には、 この型の~eventが`取消~可能$ならば “可” / 他の場合は “不可” と記される。 ◎構 `composed$m 属性に関係する — 単に[ “Yes” / “No” ]と記されているなら その値は[ ~T / ~F ]になると見受けられる — が、 実際の定義は不明 ( “Yes”, “No” の他にも とり得る値や何らかの記述があり得るかなど)。 この欄が無い~event型もあり、 その不在が何を意味するのかも不明 ( “No” を意味するのか 単に策定されていないのか判別できない)。 ◎既定動作 この欄には、 この型の~eventに結付けられ得る`既定~動作$が挙げられる (例:~pageを~scrollする)。 ◎文脈 この欄には、 この型の~eventが実装する(~interface欄に挙げられている)~interfaceの各種~memberが,どのような値に初期化されるかが述べられる。 ◎表終この表tが適用されるのは、 `~trusted$な~eventに限られる (~scriptにより配送される~eventには、 適用されない)。
以下に挙げる用語は、 この仕様が更新される前にあった記述の(かなり端折った)要約であり, 規範的な定義ではない:
- `~UA$により — 通例的に,利用者-ヤリトリに呼応して — 生成される~eventは、 `~trusted@ な~eventと呼ばれる。 対して,~scriptにより ( `dispatchEvent()$m ~methodを介して) 配送される~eventは、 ~trustedでない~eventになる (合成な~eventとも称される)。 ~trustedか否かは、 ~eventの `isTrusted$m 属性に反映される。
- ~eventが `浮上-@ ( `bubble^en )するとは、 当の~eventが`~target相$に伝播した後も,先祖へ遡るよう伝播し続けることを意味する。 その可否は~eventの `bubbles$m 属性に反映される。
- ~eventが `取消~可能@ ( `cancelable^en )であるとは、 `preventDefault()$m ~methodを~callすることで, `既定~動作$を取消せることを意味する。 その可否は、 ~eventの `cancelable$m 属性に反映される。
3.2. ~UI~event
~UI~event~moduleは、 ~UIや文書の操作に結付けられた,基本的な~event型を包含する。 ◎ The User Interface event module contains basic event types associated with user interfaces and document manipulation.
3.2.1. `UIEvent^I ~interface
DOM Level 2 にて導入された。 ◎ Introduced in DOM Level 2
`UIEvent^I ~interfaceは、 ~UI~eventに特有な文脈l情報を供する。 ◎ The UIEvent interface provides specific contextual information associated with User Interface events.
`UIEvent^I ~interfaceの~instanceを作成するためには、 その構築子に `UIEventInit^I 辞書(省略可能)を渡して呼び出す。 ◎ To create an instance of the UIEvent interface, use the UIEvent constructor, passing an optional UIEventInit dictionary.
注記: 新たに定義される~eventは、 単に~UIに関係するだけで, `UIEvent$I ~interfaceを継承する必要はない。 `UIEventInit$I の~memberのみ継承することでも,イミを成す。 ◎ For newly defined events, you don’t have to inherit UIEvent interface just because they are related to user interface. Inherit only when members of UIEventInit make sense to those events.
3.2.1.1. `UIEvent^I
[`Exposed$=Window]
interface `UIEvent@I : `Event$I {
`UIEvent@mc(`DOMString$ %type, optional `UIEventInit$I %eventInitDict = {});
readonly attribute `Window$I? `view$m;
readonly attribute `long$ `detail$m;
};
- `view@m ◎ UIEvent . view
- この属性は、 ~eventがどの `Window$I から生成されたかを識別する。 ◎ The view attribute identifies the Window from which the event was generated.
- `未初期化~値$: ~NULL ◎ The un-initialized value of this attribute MUST be null.
- `detail@m ◎ UIEvent . detail
- この属性には、 ~eventの型に依存して, `Event$I についての一部の詳細~情報が指定される。 ◎ Specifies some detail information about the Event, depending on the type of event.
- `未初期化~値$: 0 ◎ The un-initialized value of this attribute MUST be 0.
3.2.1.2. `UIEventInit^I
dictionary `UIEventInit@I : `EventInit$I {
`Window$I? `view$m = null;
`long$ `detail$m = 0;
};
- `view@m ◎ UIEventInit . view
- この~memberは、 この~eventの配送-先の大域~環境の~windowになるベキである。 この~eventが要素に配送されるなら、 その要素の`~node文書$を包含する~windowに設定されるベキである。 ◎ Should be initialized to the Window object of the global environment in which this event will be dispatched. If this event will be dispatched to an element, the view property should be set to the Window object containing the element’s ownerDocument.
- `detail@m ◎ UIEventInit . detail
- この値は、 ~appに特有な整数を与える。 ◎ This value is initialized to a number that is application-specific.
3.2.2. `UIEvent^I 用の~algo
`~UIEventを初期化する@ ~algoは、 所与の ⇒# `UIEvent$I %~event, 文字列 %~event型, `EventTarget$I %~event~target, 真偽値 %浮上するか, 真偽値 %取消~可能か ◎終 に対し: ◎ 3.2.2.1. initialize a UIEvent ◎ Input • event, the UIEvent to initialize • eventType, a DOMString containing the event type • eventTarget, the EventTarget of the event • bubbles, true if this event bubbles • cancelable, true if this event is cancelable Output • None
-
基底 `Event$I の各~属性を初期化する: ◎ Initialize the base Event attributes:
- `~eventを初期化する$( %~event, %~event型, %浮上するか, %取消~可能か ) ◎ Initialize an Event with event, eventType, bubbles and cancelable
- %~event の`~target$ev【!`target$m】 ~SET %~event~target ◎ Set event.target = eventTarget
-
`UIEvent$I の各~属性を初期化する ⇒ %~event の ⇒# `view$m ~SET %~event~target の`~node文書$の`~window$【! `Window$I ~obj】, `detail$m ~SET 0, `which$m ~SET 0
( `which^m は、 歴史的な属性であり, `MouseEvent$I, `KeyboardEvent$I どちらにも利用される。)
◎ Initialize the following public attributes: • Set event.view = the eventTarget’s node document’s Window object • Set event.detail = 0 ◎ Initialize the following historical attributes: • Set event.which = 0 (used by both MouseEvent and KeyboardEvent)
3.2.3. 各種~UI~event型
以下に,各種~UI~event型を挙げる。 これらの~eventのうち一部のものは、[ ~UIから生成されるときは `UIEvent$I / 他のときは `Event$I ]~interfaceを利用する。 詳細は各~eventに。 ◎ The User Interface event types are listed below. Some of these events use the UIEvent interface if generated from a user interface, but the Event interface otherwise, as detailed in each event.
3.2.3.1. `load^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: 【!contained】資源を読込んだ【!common】~obj
~UAは、[ ~DOM実装が資源(文書など), および すべての従属~資源(画像, ~stylesheet, ~scriptなど)の読込ngを完遂した ]とき,この~eventを発火するモノトスル。 従属~資源の読込nに失敗した場合でも、 それを読込んだ資源が~DOMを介して依然として~access可能である場合には, この~eventの発火は止めないモノトスル。 実装が,この~event型を発火するときには、 少なくとも `Document$I ~node上に配送することが要求される。 ◎ A user agent MUST dispatch this event when the DOM implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts). Dependent resources that fail to load MUST NOT prevent this event from firing if the resource that loaded them is still accessible via the DOM. If this event type is dispatched, implementations are REQUIRED to dispatch this event at least on the Document node.
注記: 旧来の理由から、 ~HTML実装においては[ 文書の内側の資源(例えば画像)用の `load$et ~eventの伝播~経路 ]は,`~window$を含まない。 詳細は `HTML$r【!HTML5】 を見よ。 ◎ For legacy reasons, load events for resources inside the document (e.g., images) do not include the Window in the propagation path in HTML implementations. See [HTML5] for more information.
3.2.3.2. `unload^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: 【!contained】資源が除去された【!common】~obj
~UAは、[ ~DOM実装が,環境から資源(文書など)や 従属~資源(画像, ~stylesheet, ~scriptなど)を除去した ]とき,この~eventを発火するモノトスル。 文書の~unloadは,この~event型が配送された後になるモノトスル。 実装が,この~event型を配送するときには、 少なくとも `Document$I ~node上に配送することが要求される。 ◎ A user agent MUST dispatch this event when the DOM Implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts). The document MUST be unloaded after the dispatch of this event type. If this event type is dispatched, implementations are REQUIRED to dispatch this event at least on the Document node.
3.2.3.3. `abort^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: 資源の読込ngが~error以外により停止された要素
~UAは、[ 資源の読込ngがまだ進捗~中に,利用者が取消したなどにより中止された ]とき,この~eventを発火するモノトスル。 ◎ A user agent MUST dispatch this event when the loading of a resource has been aborted, such as by a user canceling the load while it is still in progress.
3.2.3.4. `error^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: 資源の読込ngが~errorにより停止された要素
~UAは、[ 資源の読込nに失敗した, または読込まれたが その意味論に則って解釈-できない (妥当でない画像, ~script実行~error, 整形式でない~XMLなど) ]とき,この~eventを発火するモノトスル。 ◎ A user agent MUST dispatch this event when a resource failed to load, or has been loaded but cannot be interpreted according to its semantics, such as an invalid image, a script execution error, or non-well-formed XML.
3.2.3.5. `select^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: ~text内容が選択された要素
~UAは、[ 利用者が一部の~textを選択した ]とき,この~eventを発火するモノトスル。 この~eventは、 選択が生じた後に配送される。 ◎ A user agent MUST dispatch this event when a user selects some text. This event is dispatched after the selection has occurred.
この仕様は、 選択された~textへ~accessするための文脈l情報を供さない。 `~host言語$は、 適用-可能な所では,次のための規則を定義するベキである:
- 利用者が内容を選択できる方法 (国際的~言語~規約も考慮して)
- `select$et ~eventがどこで発火されたか
- 内容~作者がその選択された内容に~accessできる方法
注記: 利用者により選択された内容に~accessするためには、 内容~作者は,`~host言語$に備わる能力を利用することになる — HTML Editing APIs `Editing$r の `Document.getSelection()$m ~methodなど。 ◎ In order to access to user-selected content, content authors will use native capabilities of the host languages, such as the Document.getSelection() method of the HTML Editing APIs [Editing].
注記: `select$et ~eventは、 どの言語のどの要素でも可用になるとは限らない。 例えば `HTML$r【!HTML5】 においては、 `select$et ~eventが配送され得るのは,[ `input$e / `textarea$e ]要素に限られている。 実装は、[ ~form~controlの外側の~text選択, ~SVG内などの 画像や~markupの選択 ]なども含め,適切と判断される文脈にて `select$et ~eventを配送できる。 ◎ The select event might not be available for all elements in all languages. For example, in [HTML5], select events can be dispatched only on form input and textarea elements. Implementations can dispatch select events in any context deemed appropriate, including text selections outside of form controls, or image or markup selections such as in SVG.
各種~UI~eventに共通な文脈~情報
集約簡略化多くの~UI~eventに共通な文脈~情報を以下に挙げる。 個々の~event型にて定義されるものは、 これらより優先される:
- `UIEvent!I :
-
- `view$m
- `Window$I ~obj ◎ UIEvent.view : Window
- `detail$m
- 0 ◎ UIEvent.detail : 0
3.3. ~focus~event
注記: この節の~interface, および それに結付けられた[ ~event型, `~focus~event序列@#events-focusevent-event-order$ ]は、[ `~UA~accessibility指針 2.0@~UAAG20$cite `UAAG20$r に定義される概念と指針 ]に則って,特に[ `~focusの仕組み@~UAAG20#gl-focus-mechanism$, および `~focusの用語集@~UAAG20#def-focus$ に定義される用語 ]に~~注目して設計されている。 ◎ This interface and its associated event types and § 3.3.2 Focus Event Order were designed in accordance to the concepts and guidelines defined in User Agent Accessibility Guidelines 2.0 [UAAG20], with particular attention on the focus mechanism and the terms defined in the glossary entry for focus.
3.3.1. `FocusEvent^I ~interface
この仕様にて導入された。 ◎ Introduced in this specification
`FocusEvent^I ~interfaceは、 ~focus~eventに特有な文脈l情報を供する。 ◎ The FocusEvent interface provides specific contextual information associated with Focus events.
`FocusEvent^I ~interfaceの~instanceを作成するためには、 その構築子に `FocusEventInit^I 辞書(省略可能)を渡して呼び出す。 ◎ To create an instance of the FocusEvent interface, use the FocusEvent constructor, passing an optional FocusEventInit dictionary.
3.3.1.1. `FocusEvent^I
[`Exposed$=Window]
interface `FocusEvent@I : `UIEvent$I {
`FocusEvent@mc(`DOMString$ %type, optional `FocusEventInit$I %eventInitDict = {});
readonly attribute `EventTarget$I? `relatedTarget$m;
};
- `relatedTarget@m ◎ FocusEvent . relatedTarget
- ~focus~eventに関係する副次的な `EventTarget$I を識別するために利用され、 ~eventの型に依存する。 ◎ Used to identify a secondary EventTarget related to a Focus event, depending on the type of event.
- ~securityの理由から、 入子な関係にある閲覧~文脈どうしで~focusが~~移動したときには【!tabbing into or out 】, この属性の値【!関連な EventTarget 】は ~NULL になるベキである。 ◎ For security reasons with nested browsing contexts, when tabbing into or out of a nested context, the relevant EventTarget SHOULD be null.
- `未初期化~値$: ~NULL ◎ The un-initialized value of this attribute MUST be null.
3.3.1.2. `FocusEventInit^I
dictionary `FocusEventInit@I : `UIEventInit$I {
`EventTarget$I? `relatedTarget@m = null;
};
この辞書の各~memberは、 `FocusEventInit!I ~obj上の同じ名前の属性を初期化する。 それぞれがとり得る値とその意味については、 その~interface定義の記述を見よ。 ◎ FocusEventInit . relatedTarget • The relatedTarget should be initialized to the element losing focus (in the case of a focus or focusin event) or the element gaining focus (in the case of a blur or focusout event).
3.3.2. ~focus~event序列
この仕様にて定義される~focus~eventは、 相互相対順序の下で生じる。 被focus要素が無い状態から要素 %A, 要素 %B の順に~focusが移転されたときの代表的な~event連列を次に示す: ◎ The focus events defined in this specification occur in a set order relative to one another. The following is the typical sequence of events when a focus is shifted between elements (this order assumes that no element is initially focused):
| ~event型 | 備考 | |
|---|---|---|
| 利用者が~focusを移転した ◎ User shifts focus | ||
| 1. | `focus$et | %A が~focusを受取った直後に送信される ◎ Sent after first target element receives focus |
| 2. | `focusin$et | `focus$et ~eventに後続する ◎ Follows the focus event |
| 利用者が~focusを移転した ◎ User shifts focus | ||
| 3. | `blur$et | %A が~focusを失った直後に送信される ◎ Sent after first target element loses focus |
| 4. | `focusout$et | `blur$et ~eventに後続する ◎ Follows the blur event |
| 5. | `focus$et | %B が~focusを受取った直後に送信される ◎ Sent after second target element receives focus |
| 6. | `focusin$et | `focus$et ~eventに後続する ◎ Follows the focus event |
注記: この仕様は、 `focus()^m や `blur()^m などの~methodに際しての~focus~eventの挙動は定義しない。 そのような挙動については、 それらの~methodを定義している,関連な仕様を見よ。 ◎ This specification does not define the behavior of focus events when interacting with methods such as focus() or blur(). See the relevant specifications where those methods are defined for such behavior.
3.3.3. 文書~focusと~focus文脈
この~event~moduleは、 文書`~focus$の変化を通知するための~event型を含む。 この論点に関連な,3 種の別個な~focus文脈がある: ◎ This event module includes event types for notification of changes in document focus. There are three distinct focus contexts that are relevant to this discussion:
- ~OS~focus文脈 ⇒ この文脈の下では、 ~computer上で現在~稼働している多数の~appのうち一つが,~focusを持ち得るとされる。 ~browserは、 その一つを成し得る。 ◎ The operating system focus context which MAY be on one of many different applications currently running on the computer. One of these applications with focus can be a browser.
- ~app~focus文脈 ⇒ ~browserが~focusを得ているときが,この文脈である。 この文脈の下では、 利用者は、 ~browserの各種~UI~field (例: ~URL~bar, 探索~field, 等々) 間で~focusを切替えることもある (~tab~UIkeyなどにより)。 ~UItab内に示されている文書も、 これらの~UI~fieldの一つを成し得る。 ◎ When the browser has focus, the user can switch (such as with the tab key) the application focus context among the different browser user interface fields (e.g., the Web site location bar, a search field, etc.). One of these user interface fields can be the document being shown in a tab.
- 文書~focus文脈 ⇒ 文書~自身が~focusを得ているときが、 この文脈である。 この文脈の下では、 文書~内で~focus可能な要素が~focusを得ることができる。 ◎ When the document itself has focus, the document focus context can be set to any of the focusable elements in the document.
この仕様にて定義される各種~event型は、 もっぱら文書~focusのみを対象にする。 ~eventの詳細~にて識別される`~target$は、 ~window内の文書またその一部に限るモノトスル — ~focus文脈が別の文脈へ切替わったときでも,決して ~browserや~OSの一部にはならない。 ◎ The event types defined in this specification deal exclusively with document focus, and the event target identified in the event details MUST only be part of the document or documents in the window, never a part of the browser or operating system, even when switching from one focus context to another.
通常は、 文書は常に被focus要素を持ち (他に無ければ,`文書~要素$が被focus要素になる)、 また,`~focus環$を持ち続ける。 ~focus文脈が切替わっても,文書における現在の被focus要素, および文書の`~focus環$は、 通常は現在の状態を保ち続ける。 例えば,文書にて~focus可能な要素が 3 個あって, 2 個目の要素が~focusされている下で、 利用者が~OS~focusを別の~appに変更してから また~browserに戻ったとき、 2 個目の要素は,文書の中で依然として被focusのままにされ、 ~tabbingなどで~focusが切り替えられたときは, 3 個目の要素に~focusが移ることになる。
`~host言語$は、 次を定義してもヨイ:
- どの要素が~focusを受取れるか
- 要素はどの条件の下で~focusを受取るか
- ~focusはどの手段で変更できるか
- ~focusはどの順序で変化するか
例えば, 要素に~pointerが接触するだけで要素が~focusを得ることもあれば、 ~clickを要する状況下もある。 要素には、 まったく~focusされ得ないものもあれば、 特別な手段(要素~上を~clickするなど)を通してなら~focusできるが,~tabbingでは~focusできないものもある。 文書は、 複数の`~focus環$を包含してもヨイ。
他の仕様は、 この仕様にて述べるものより複階的な~focus~modelを定義してもヨイ — 複数の要素が,現在の~focusを得られるようにすることも含め。
◎ Normally, a document always has a focused element (even if it is the document element itself) and a persistent focus ring. When switching between focus contexts, the document’s currently focused element and focus ring normally remain in their current state. For example, if a document has three focusable elements, with the second element focused, when a user changes operating system focus to another application and then back to the browser, the second element will still be focused within the document, and tabbing will change the focus to the third element. A host language MAY define specific elements which might receive focus, the conditions under which an element MAY receive focus, the means by which focus MAY be changed, and the order in which the focus changes. For example, in some cases an element might be given focus by moving a pointer over it, while other circumstances might require a mouse click. Some elements might not be focusable at all, and some might be focusable only by special means (clicking on the element), but not by tabbing to it. Documents MAY contain multiple focus rings. Other specifications MAY define a more complex focus model than is described in this specification, including allowing multiple elements to have the current focus.3.3.4. 各種~focus~event型
以下に,各種~focus~event型を挙げる: ◎ The Focus event types are listed below.
3.3.4.1. `blur^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: ~focusを失った`~event~target$
- `FocusEvent.relatedTarget$m: 新たに~focusを受取っている`~event~target$。
~UAは、 要素が~focusを失った直後に, 当の要素に向けて この~eventを発火するモノトスル。 この~event型は、 `focusout$et に類似するが,浮上しない。 ◎ A user agent MUST dispatch this event when an event target loses focus. The focus MUST be taken from the element before the dispatch of this event type. This event type is similar to focusout, but does not bubble.
3.3.4.2. `focus^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: 新たに~focusを受取った`~event~target$
- `FocusEvent.relatedTarget$m: ~focusを失っている`~event~target$(もしあれば)。
~UAは、 要素が~focusを受取った直後に, 当の要素に向けて この~eventを発火するモノトスル。 この~event型は、 `focusin$et に類似するが,浮上しない。 ◎ A user agent MUST dispatch this event when an event target receives focus. The focus MUST be given to the element before the dispatch of this event type. This event type is similar to focusin, but does not bubble.
3.3.4.3. `focusin^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: 新たに~focusを受取った`~event~target$
- `FocusEvent.relatedTarget$m: ~focusを失っている`~event~target$(もしあれば)。
~UAは、[ 要素が~focusを受取った直後 ]かつ[ 当の要素に向けて `focus$et ~eventを配送した後 ]に,当の要素に向けて この~eventを発火するモノトスル。 この~event型は、 `focus$et に類似するが,浮上する。 ◎ A user agent MUST dispatch this event when an event target receives focus. The event target MUST be the element which received focus. The focus event MUST fire before the dispatch of this event type. This event type is similar to focus, but does bubble.
3.3.4.4. `focusout^et
次に挙げるものを除き, `§ 各種~UI~eventに共通な文脈~情報$ を見よ:
- `target$m: ~focusを失った`~event~target$
- `FocusEvent.relatedTarget$m: 新たに~focusを受取っている`~event~target$。
~UAは、[ 要素が~focusを失った直後 ]かつ[ 当の要素に向けて `blur$et ~eventを配送した後 ]に, 当の要素に向けて この~eventを発火するモノトスル。 この~event型は、 `blur$et に類似するが,浮上する。 ◎ A user agent MUST dispatch this event when an event target loses focus. The event target MUST be the element which lost focus. The blur event MUST fire before the dispatch of this event type. This event type is similar to blur, but does bubble.
3.4. 入力~event型
入力~eventは、 利用者-動作の直接的な結果として (例:編集-可能な領域~内での~keyboard入力や, 整形-中にある~textを削除したとき, 等々) ~DOMが更新された(または,されつつある)とき,通知として送信される。 ◎ Input events are sent as notifications whenever the DOM is being updated (or about to be updated) as a direct result of a user action (e.g., keyboard input in an editable region, deleting or formatting text, ...).
3.4.1. `InputEvent^I ~interface
3.4.1.1. `InputEvent^I
DOM3 にて導入された。 ◎ Introduced in DOM Level 3
[`Exposed$=Window]
interface `InputEvent@I : `UIEvent$I {
`InputEvent@mc(`DOMString$ %type, optional `InputEventInit$I %eventInitDict = {});
readonly attribute `USVString$? `data$m;
readonly attribute `boolean$ `isComposing$m;
readonly attribute `DOMString$ `inputType$m;
};
- `data@m ◎ data, of type USVString, readonly, nullable
- ~IMEにより生成される~Unicode文字 `Unicode$r 並びの値を保持する — `空~文字列$にもなり得る。 一連の文字は、 `UAX15$r にて定義される~Unicode正規化~形 `NFC^em による定義に従って正規化されるベキである。 ◎ data holds the value of the characters generated by an input method. This MAY be a single Unicode character or a non-empty sequence of Unicode characters [Unicode]. Characters SHOULD be normalized as defined by the Unicode normalization form NFC, defined in [UAX15]. This attribute MAY contain the empty string.
- `未初期化~値$: ~NULL ◎ The un-initialized value of this attribute MUST be null.
- `isComposing@m ◎ isComposing, of type boolean, readonly
- 入力~eventが組成~sessionの一部として — すなわち, `compositionstart$et ~eventの後, かつ 対応する `compositionend$et ~eventの前に — 生じたならば~T。 ◎ true if the input event occurs as part of a composition session, i.e., after a compositionstart event and before the corresponding compositionend event.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `inputType@m ◎ inputType, of type DOMString, readonly
- ~eventに結付けられた[ 入力の型 ]を識別する文字列を包含する。 ◎ inputType contains a string that identifies the type of input associated with the event.
- この属性に妥当な値たちが成す~listは `Input-Events$r を見よ。 ◎ For a list of valid values for this attribute, refer to the [Input-Events] specification.
- `未初期化~値$: 空~文字列 ◎ The un-initialized value of this attribute MUST be the empty string "".
3.4.1.2. `InputEventInit^I
dictionary `InputEventInit@I : `UIEventInit$I {
`DOMString$? `data@m = null;
`boolean$ `isComposing@m = false;
`DOMString$ `inputType@m = "";
};
この辞書の各~memberは、 `InputEvent$I ~obj上の同じ名前の属性を初期化する。 それぞれがとり得る値とその意味については、 その~interface定義の記述を見よ。 ◎ data, of type DOMString, nullable, defaulting to null • Initializes the data attribute of the InputEvent object. ◎ isComposing, of type boolean, defaulting to false • Initializes the isComposing attribute of the InputEvent object. ◎ inputType, of type DOMString, defaulting to "" • Initializes the inputType attribute of the InputEvent object.
3.4.2. 入力~event序列
この仕様にて定義される入力~eventは、 相互相対順序の下で生じるモノトスル。 ◎ The input events defined in this specification MUST occur in a set order relative to one another.
| ~event型 | 備考 | |
|---|---|---|
| 1. | `beforeinput$et | |
| DOM 要素は更新された ◎ DOM element is updated | ||
| 2. | `input$et |
3.4.3. 各種~入力~event型
3.4.3.1. `beforeinput^et
次に挙げるものを除き, `§ 各種~入力~eventに共通な文脈~情報$ を見よ:
- `InputEvent.data$m は、 内容が削除されることになる場合は, ~NULL にされてもヨイ。
~UAは、 ~DOMが更新されつつあるとき,この~eventを発火するモノトスル。 ◎ A user agent MUST dispatch this event when the DOM is about to be updated.
3.4.3.2. `input^et
次に挙げるものを除き, `§ 各種~入力~eventに共通な文脈~情報$ を見よ:
- `InputEvent.data$m は、 内容が削除された場合には,`空~文字列$にされてもヨイ。
~UAは、 ~DOMが更新された直後に,この~eventを発火するモノトスル。 ◎ A user agent MUST dispatch this event immediately after the DOM has been updated.
各種~入力~eventに共通な文脈~情報
集約簡略化各種~入力~eventに共通な文脈~情報を以下に挙げる。 個々の~event型にて定義されるものは、 これらより優先される:
- `target$m
- 更新されつつある/された`~event~target$。 ◎ event target that [ is about to be / was just ] updated
- `UIEvent!I の各~属性:
- `§ 各種~UI~eventに共通な文脈~情報$を見よ。
- `InputEvent!I :
-
- `data$m
- 要素に追加された/されることになる~dataを包含する文字列。 内容が削除されることになる/された場合には、 ~eventの型に応じて,`空~文字列$または~NULLにされてもヨイ。 ◎ InputEvent.data : the string containing the data that [ has been | will be ] added to the element, which MAY be [ the empty string | null ] if the content [ will be | has been ] deleted
- `isComposing$m
- この~eventが`~dead-key@#keys-dead$連列, または `~IME$が作動中な間に配送されたものであれば ~T (`組成~event$が配送されているときなど) / ~ELSE_ ~F ◎ InputEvent.isComposing : true if this event is dispatched during a dead key sequence or while an input method editor is active (such that composition events are being dispatched); false otherwise.
3.5. ~keyboard~event型
~keyboard~eventは、 装置~依存である — すなわち,それは、[ 入力~装置の能力, および 【物理的な~UIkeyが】 ~OSにてどう対応付けられているか ]に依拠する。 詳細は、 ~keyboard~eventと`組成~event$とを組合せる用例も含め, `§ ~keyboard~eventと~UIkey値$を見よ。 文字~生成~装置によっては,~keyboard~eventを生成しないものもある。 ◎ Keyboard events are device dependent, i.e., they rely on the capabilities of the input devices and how they are mapped in the operating systems. Refer to Keyboard events and key values for more details, including examples on how Keyboard Events are used in combination with Composition Events. Depending on the character generation device, keyboard events might not be generated.
注記: ~keyboard~eventは、 ~textな入力を供する~~方式( `modality^en )の一つにすぎない。 編集~時には、 ~keyboard~eventを代替するもの(または それへの追加)として, `InputEvent$I の利用も考慮すること。 ◎ Keyboard events are only one modality of providing textual input. For editing scenarios, consider also using the InputEvent as an alternate to (or in addition to) keyboard events.
【 参考: `Keyboard Event Viewer@https://w3c.github.io/uievents/tools/key-event-viewer.html$en にて、 各種~keyboard~eventの挙動を試せる。 】
3.5.1. `KeyboardEvent^I ~interface
この仕様にて導入された。 ◎ Introduced in this specification
`KeyboardEvent!I ~interfaceは、 ~keyboard装置に特有な文脈l情報を供する。 各~keyboard~eventは、 値を利用して~UIkeyを参照する。 ~keyboard~eventは、 共通して,~focusを得ている要素へ向けられることが多い。 ◎ The KeyboardEvent interface provides specific contextual information associated with keyboard devices. Each keyboard event references a key using a value. Keyboard events are commonly directed at the element that has the focus.
`KeyboardEvent$I ~interfaceは、 一部の共通的な修飾~UIkey用の簡便な属性:[ `ctrlKey$m, `shiftKey$m, `altKey$m, `metaKey$m ]を供する。 これらの属性【への取得~access】は、 順に,[ `Control$kY, `Shift$kY, `Alt$kY, `Meta$kY ]を引数に `getModifierState()$m ~methodを利用するのと等価である。 ◎ The KeyboardEvent interface provides convenient attributes for some common modifiers keys: ctrlKey, shiftKey, altKey, metaKey. These attributes are equivalent to using the method getModifierState() with Control, Shift, Alt, or Meta respectively.
`KeyboardEvent^I ~interfaceの~instanceを作成するためには、 その構築子に `KeyboardEventInit$I 辞書(省略可能)を渡して呼び出す。 ◎ To create an instance of the KeyboardEvent interface, use the KeyboardEvent constructor, passing an optional KeyboardEventInit dictionary.
3.5.1.1. `KeyboardEvent^I
[`Exposed$=Window]
interface `KeyboardEvent@I : `UIEvent$I {
`KeyboardEvent@mc(`DOMString$ %type, optional `KeyboardEventInit$I %eventInitDict = {});
// `location$m 属性がとり得る定数
const `unsigned long$ `DOM_KEY_LOCATION_STANDARD$m = 0x00;
const `unsigned long$ `DOM_KEY_LOCATION_LEFT$m = 0x01;
const `unsigned long$ `DOM_KEY_LOCATION_RIGHT$m = 0x02;
const `unsigned long$ `DOM_KEY_LOCATION_NUMPAD$m = 0x03;
readonly attribute `DOMString$ `key$m;
readonly attribute `DOMString$ `code$m;
readonly attribute `unsigned long$ `location$m;
readonly attribute `boolean$ `ctrlKey$m;
readonly attribute `boolean$ `shiftKey$m;
readonly attribute `boolean$ `altKey$m;
readonly attribute `boolean$ `metaKey$m;
readonly attribute `boolean$ `repeat$m;
readonly attribute `boolean$ `isComposing$m;
`boolean$ `getModifierState$m(`DOMString$ %keyArg);
};
- `DOM_KEY_LOCATION_STANDARD@m
- 作動化された~UIkeyは、 ~UIkeyの[ 左/右 ]~versionとして判別されるものではなく,かつ 十key( `NumLock^cap ~UIkeyは除く), または それに対応する~virtual~UIkeyからも出生されていないことを指示する。 ◎ The key activation MUST NOT be distinguished as the left or right version of the key, and (other than the NumLock key) did not originate from the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad).
-
~PC101US~keyboardの `Q^cap ~UIkey。 ◎ The Q key on a PC 101 Key US keyboard.
~PC101US~keyboardの `NumLock^cap ~UIkey。 ◎ The NumLock key on a PC 101 Key US keyboard.
~PC101US~keyboardの主区画に所在する `1^cap ~UIkey。 ◎ The 1 key on a PC 101 Key US keyboard located in the main section of the keyboard.
- `DOM_KEY_LOCATION_LEFT@m
- 作動化された~UIkeyは、 左~UIkey所在から出生されていることを指示する (当の~UIkey用にアリな所在が複数ある場合に限る)。 ◎ The key activated originated from the left key location (when there is more than one possible location for this key).
- ~PC101US~keyboardの左 `Control^cap ~UIkey。 ◎ The left Control key on a PC 101 Key US keyboard.
- `DOM_KEY_LOCATION_RIGHT@m
- 作動化された~UIkeyは、 右~UIkey所在から出生されていることを指示する (当の~UIkey用にアリな所在が複数ある場合に限る)。 ◎ The key activation originated from the right key location (when there is more than one possible location for this key).
- ~PC101US~keyboardの 右 `Shift^cap ~UIkey。 ◎ The right Shift key on a PC 101 Key US keyboard.
- `DOM_KEY_LOCATION_NUMPAD@m
- 作動化された~UIkeyは、 十key, または それに 対応する~virtual~UIkeyから出生されていることを指示する (当の~UIkey用にアリな所在が複数ある場合に限る)。 `NumLock^cap ~UIkeyは常に,所在 `DOM_KEY_LOCATION_STANDARD$m を伴って符号化されるベキであることに注意。 ◎ The key activation originated on the numeric keypad or with a virtual key corresponding to the numeric keypad (when there is more than one possible location for this key). Note that the NumLock key should always be encoded with a location of DOM_KEY_LOCATION_STANDARD.
- ~PC101US~keyboardの ~numpadに所在する `1^cap ~UIkey。 ◎ The 1 key on a PC 101 Key US keyboard located on the numeric pad.
- `key@m ◎ key, of type DOMString, readonly
- 押された~UIkeyに対応する`~UIkey属性~値$を保持する。 ◎ key holds a key attribute value corresponding to the key pressed.
- 注記: `key^m 属性は,旧来の `keyCode$m 属性には関係しない — とり得る値の集合も同じでない。 ◎ The key attribute is not related to the legacy keyCode attribute and does not have the same set of values.
- `未初期化~値$: `空~文字列$ ◎ The un-initialized value of this attribute MUST be "" (the empty string).
- `code@m ◎ code, of type DOMString, readonly
- `code^m は、 押されている物理的~UIkeyを識別する文字列を保持する。 値は,現在の~keyboard~layoutや修飾~状態からは影響されないので、 同じ~UIkeyからは常に同じ値が返されることになる。 ◎ code holds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
- `未初期化~値$: `空~文字列$ ◎ The un-initialized value of this attribute MUST be "" (the empty string).
- `location@m ◎ location, of type unsigned long, readonly
- `location^m 属性は、 装置~上の~UIkeyの論理的な所在の指示を包含する。 ◎ The location attribute contains an indication of the logical location of the key on the device.
- この属性は、[ 装置~上の~UIkeyの所在を指示する, `DOM_KEY_LOCATION-…^m 定数 ]のうちの,いずれかに設定するモノトスル。 ◎ This attribute MUST be set to one of the DOM_KEY_LOCATION constants to indicate the location of a key on the device.
- 【環境設定により】~UIkeyを対応付-直すことを許容する~UAは、 対応付けられた~~元の~UIkey用の `location$m 値を,新たな~UIkeyに適切な値に設定するモノトスル。 例えば, `ControlLeft$kC ~UIkeyが `KeyQ$kC ~UIkeyに対応付-直されたなら、 この属性は `DOM_KEY_LOCATION_STANDARD$m に設定するモノトスル。 逆に, `KeyQ$kC ~UIkeyが左右いずれかの `Control^cap ~UIkeyに対応付-直された場合、 それに応じて,この属性も[ `DOM_KEY_LOCATION_LEFT$m, `DOM_KEY_LOCATION_RIGHT$m ]のいずれかに設定するモノトスル。 ◎ If a user agent allows keys to be remapped, then the location value for a remapped key MUST be set to a value which is appropriate for the new key. For example, if the "ControlLeft" key is mapped to the "KeyQ" key, then the location attribute MUST be set to DOM_KEY_LOCATION_STANDARD. Conversely, if the "KeyQ" key is remapped to one of the Control keys, then the location attribute MUST be set to either DOM_KEY_LOCATION_LEFT or DOM_KEY_LOCATION_RIGHT.
- `未初期化~値$: 0 ◎ The un-initialized value of this attribute MUST be 0.
- `ctrlKey@m ◎ ctrlKey, of type boolean, readonly
- `Control^cap ( control )修飾が作動中であったならば~T ◎ true if the Control (control) key modifier was active.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `shiftKey@m ◎ shiftKey, of type boolean, readonly
- `Shift^cap ( shift )修飾が作動中であったならば~T。 ◎ true if the shift (Shift) key modifier was active.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `altKey@m ◎ altKey, of type boolean, readonly
- `Alt^cap ( alternative, ~~別名 `Option^cap )修飾が作動中であったならば~T。 ◎ true if the Alt (alternative) (or "Option") key modifier was active.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `metaKey@m ◎ metaKey, of type boolean, readonly
- `Meta^cap( meta )修飾が作動中であったならば~T。 ◎ true if the meta (Meta) key modifier was active.
- 注記: Macintosh ~system上の `Command^cap ( `⌘^cap )~UIkey修飾は この~UIkey修飾を利用して表現される。 ◎ The "Command" ("⌘") key modifier on Macintosh systems is represented using this key modifier.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `repeat@m ◎ repeat, of type boolean, readonly
- ~UIkeyが~~持続的に押されているならば ~T 。 ~UIkeyが~~押下げ続けられている下では、[ `keydown$et, `beforeinput$et, `input$et ]~eventが、 この順序で,~system環境設定から決定される~rateで,繰返すモノトスル。 `~UIkeyの長押し^em に対する挙動を備える携帯~機器においては、 `repeat$m 属性~値に ~T を伴う最初の~UIkey~eventが,その挙動を指示する~~役割を果たすモノトスル。 繰返され始めるまで~UIkeyを押し続ける必要がある時間の長さは、 環境設定に依存する。 ◎ true if the key has been pressed in a sustained manner. Holding down a key MUST result in the repeating the events keydown, beforeinput, input in this order, at a rate determined by the system configuration. For mobile devices which have long-key-press behavior, the first key event with a repeat attribute value of true MUST serve as an indication of a long-key-press. The length of time that the key MUST be pressed in order to begin repeating is configuration-dependent.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `isComposing@m ◎ isComposing, of type boolean, readonly
- ~UIkey~eventが組成~sessionの一部として — すなわち, `compositionstart$et ~eventの後, かつ 対応する `compositionend$et ~eventの前に — 生じたならば~T。 ◎ true if the key event occurs as part of a composition session, i.e., after a compositionstart event and before the corresponding compositionend event.
- `未初期化~値$: ~F ◎ The un-initialized value of this attribute MUST be false.
- `getModifierState(keyArg)@m
- `~UIkey値$を利用して,ある修飾の状態を~queryする。 ◎ Queries the state of a modifier using a key value.
- [ %keyArg は修飾~UIkey用の`~UIkey値$であって,その~UIkeyは作動化されているならば ~T / ~ELSE_ ~F ]を返す。 ◎ Returns true if it is a modifier key and the modifier is activated, false otherwise.
- 引数 %keyArg には、 修飾`~UIkey値$を与える。 妥当な`修飾~UIkey$は、 `UIEvents-Key$r の`修飾~UIkeyの表t$にて定義される。 ◎ DOMString keyArg ◎ A modifier key value. Valid modifier keys are defined in the Modifier Keys table in [UIEvents-Key].
- 注記: ~appが 右, 左の修飾を判別したいと望む場合、 この情報は, ~keyboard~event, および `KeyboardEvent.location$m を利用して演繹することもできる。 ◎ If an application wishes to distinguish between right and left modifiers, this information could be deduced using keyboard events and location.
3.5.1.2. `KeyboardEventInit^I
dictionary `KeyboardEventInit@I : `EventModifierInit$I {
`DOMString$ `key@m = "";
`DOMString$ `code@m = "";
`unsigned long$ `location@m = 0;
`boolean$ `repeat@m = false;
`boolean$ `isComposing@m = false;
};
この辞書の各~memberは、 `KeyboardEvent$I ~obj上の同じ名前の属性を初期化する。 それぞれがとり得る値とその意味については、 その~interface定義の記述を見よ。 ◎ key, of type DOMString, defaulting to "" • Initializes the key attribute of the KeyboardEvent object to the unicode character string representing the meaning of a key after taking into account all keyboard modifiers (such as shift-state). This value is the final effective value of the key. If the key is not a printable character, then it should be one of the key values defined in [UIEvents-Key]. ◎ code, of type DOMString, defaulting to "" • Initializes the code attribute of the KeyboardEvent object to the unicode character string representing the key that was pressed, ignoring any keyboard modifications such as keyboard layout. This value should be one of the code values defined in [UIEvents-Code]. ◎ location, of type unsigned long, defaulting to 0 • Initializes the location attribute of the KeyboardEvent object to one of the following location numerical constants: • DOM_KEY_LOCATION_STANDARD (numerical value 0) • DOM_KEY_LOCATION_LEFT (numerical value 1) • DOM_KEY_LOCATION_RIGHT (numerical value 2) • DOM_KEY_LOCATION_NUMPAD (numerical value 3) ◎ repeat, of type boolean, defaulting to false • Initializes the repeat attribute of the KeyboardEvent object. This attribute should be set to true if the the current KeyboardEvent is considered part of a repeating sequence of similar events caused by the long depression of any single key, false otherwise. ◎ isComposing, of type boolean, defaulting to false • Initializes the isComposing attribute of the KeyboardEvent object. This attribute should be set to true if the event being constructed occurs as part of a composition sequence, false otherwise.
旧来の~keyboard~event実装は 3 種の追加的な属性[ `keyCode$m, `charCode$m, `which$m ]を含んでいる。 `keyCode^m 属性は[ ~computer~keyboardの特定0の~UIkeyに結付けられた数的な値 ]を指示する一方、 `charCode^m 属性は[ その~UIkeyに結付けられた文字の~ASCII値 ]を指示し( `keyCode^m 値と同じにもなり得る), 適用-可能なのは`文字~値$を生産する~UIkeyに限られる。 ◎ Legacy keyboard event implementations include three additional attributes, keyCode, charCode, and which. The keyCode attribute indicates a numeric value associated with a particular key on a computer keyboard, while the charCode attribute indicates the ASCII value of the character associated with that key (which might be the same as the keyCode value) and is applicable only to keys that produce a character value.
実施においては、[ `keyCode^m, `charCode^m ]は,[ ~platform間で, あるいは 同じ実装ですら 種々の~OSや地域化の間で ]一貫でない。 この仕様は[ `keyCode^m, `charCode^m ]の値も, `charCode^m の挙動も定義しない。 適合~UI~Events実装においては,内容~作者は、[ `KeyboardEvent.key$m, `KeyboardEvent.code$m ]を利用できる。 ◎ In practice, keyCode and charCode are inconsistent across platforms and even the same implementation on different operating systems or using different localizations. This specification does not define values for either keyCode or charCode, or behavior for charCode. In conforming UI Events implementations, content authors can instead use key and code.
更なる情報は、 参考な `§ 旧来の~UIkey属性@~UIEVENTS-A#legacy-key-attributes$ を見よ。 ◎ For more information, see the informative appendix on Legacy key attributes.
注記: 既存の内容との互換性のため,~virtual~keyboard — ~screenに基づく入力~装置~上の~software~keyboardなど — は、[ 物理的~UIkeyを処理しなくとも,通常の範囲の~keyboard~eventを生産する ]ものと期待されている。 ◎ For compatibility with existing content, virtual keyboards, such as software keyboards on screen-based input devices, are expected to produce the normal range of keyboard events, even though they do not possess physical keys.
注記: 一部の実装/~system環境設定においては、 一部の~UIkey~eventやその値は,利用-中にある`~IME$により抑止されることがある。 ◎ In some implementations or system configurations, some key events, or their values, might be suppressed by the IME in use.
3.5.2. ~keyboard~eventに対する~UIkeyの所在
`location$m 属性は、 ~keyboard上の異なる物理的~UIkeyから同じ`~UIkey値$が生成される場合に, それらを~~区別するために利用できる。 例えば、 左右 `Shift^cap ~UIkey,あるいは 物理的~矢印~UIkeyと( `NumLock^cap が off のときの)~numpad上の矢印~UIkey。 ◎ The location attribute can be used to disambiguate between key values that can be generated by different physical keys on the keyboard, for example, the left and right Shift key or the physical arrow keys vs. the numpad arrow keys (when NumLock is off).
~keyboard上に所在が複数あるような特別な~UIkey用の,妥当な `location$m 値は、 次の表tに定義される: ◎ The following table defines the valid location values for the special keys that have more than one location on the keyboard:
| `key$m 値 ◎ KeyboardEvent . key | 妥当な `location$m 値 ◎ Valid location values |
|---|---|
| `Shift$kY, `Control$kY, `Alt$kY, `Meta$kY | `DOM_KEY_LOCATION_LEFT$m, `DOM_KEY_LOCATION_RIGHT$m |
| `ArrowDown$kY, `ArrowLeft$kY, `ArrowRight$kY, `ArrowUp$kY | `DOM_KEY_LOCATION_STANDARD$m, `DOM_KEY_LOCATION_NUMPAD$m |
| `End$kY, `Home$kY, `PageDown$kY, `PageUp$kY | `DOM_KEY_LOCATION_STANDARD$m, `DOM_KEY_LOCATION_NUMPAD$m |
| `0^kY, `1^kY, `2^kY, `3^kY, `4^kY, `5^kY, `6^kY, `7^kY, `8^kY, `9^kY, `.^kY, `Enter$kY, `+^kY, `-^kY, `*^kY, `/^kY, | `DOM_KEY_LOCATION_STANDARD$m, `DOM_KEY_LOCATION_NUMPAD$m |
この表tに挙げられていない他のすべての~UIkey用の `location$m 属性は、 常に `DOM_KEY_LOCATION_STANDARD$m に設定するモノトスル。 ◎ For all other keys not listed in this table, the location attribute MUST always be set to DOM_KEY_LOCATION_STANDARD.
3.5.3. ~eventの~UIkey修飾~初期化子
[ `MouseEvent$I, `KeyboardEvent$I ]~interfaceは、 各種~keyboard修飾~属性を共有し, 追加的な修飾~状態を検索取得するための仕組みを~supportする。 `EventModifierInit$I 辞書は、 作者が[ これらの~interfaceの各種~keyboard修飾~属性 ]および[[ 前者の `getModifierState()@~POINTEREVENTS#dom-mouseevent-getmodifierstate$m / 後者の `KeyboardEvent.getModifierState()$m ]を介して~queryされる追加的な修飾~状態 ]を初期化することを可能化する。 この辞書を利用して~mouse~eventを構築する手続きは、 `POINTEREVENTS4$r にて定義される†。 ◎ The MouseEvent and KeyboardEvent interfaces share a set of keyboard modifier attributes and support a mechanism for retrieving additional modifier states. The following dictionary enables authors to initialize keyboard modifier attributes of the MouseEvent and KeyboardEvent interfaces, as well as the additional modifier states queried via getModifierState(). The steps for constructing mouse events using this dictionary are defined in the [pointerevents4] specification.
【† `§ ~mouse~eventの構築-法@~POINTEREVENTS#constructing-mouse-events$ — それは、 元々はこの仕様にて定義されたたものであり, そこに述べられる処理nは `KeyboardEvent$I を構築する際にも適用されるべきであろう (そこで `MouseEvent$I 用に定義される`内部~UIkey修飾~状態$は、 `KeyboardEvent$I 用にも定義されるものと見なすべきである)。 】
dictionary `EventModifierInit@I : `UIEventInit$I {
`boolean$ `ctrlKey$m = false;
`boolean$ `shiftKey$m = false;
`boolean$ `altKey$m = false;
`boolean$ `metaKey$m = false;
`boolean$ `modifierAltGraph$m = false;
`boolean$ `modifierCapsLock$m = false;
`boolean$ `modifierFn$m = false;
`boolean$ `modifierFnLock$m = false;
`boolean$ `modifierHyper$m = false;
`boolean$ `modifierNumLock$m = false;
`boolean$ `modifierScrollLock$m = false;
`boolean$ `modifierSuper$m = false;
`boolean$ `modifierSymbol$m = false;
`boolean$ `modifierSymbolLock$m = false;
};
以下において、 %~event は[ `MouseEvent$I / `KeyboardEvent$I ]いずれかを実装する~event~obj, `getModifierState()^m は %~event 上の同じ名前の~methodを表すとする。
- `ctrlKey@m
- `shiftKey@m
- `altKey@m
- `metaKey@m
-
これらの各~memberは、 %~event 上の同じ名前の属性を初期化する。 値の意味は、 `KeyboardEvent$I の同じ名前の属性の記述を見よ。
加えて,実装は、 %~event の`内部~UIkey修飾~状態$を[ 次の表tの 2 列目に挙げる値を引数に %~event 上の `getModifierState()^m が呼出されたときは,同じ行の 1 列目に挙げる名前の~member値が返される ]ように初期化するモノトスル。
名前 引数 `altKey^c `Alt^l【!^cap】 `ctrlKey^c `Control^l `altKey^c `Meta^l `shiftKey^c `Shift^l - `modifierAltGraph@m
- `modifierCapsLock@m
- `modifierFn@m
- `modifierFnLock@m
- `modifierHyper@m
- `modifierNumLock@m
- `modifierScrollLock@m
- `modifierSuper@m
- `modifierSymbol@m
- `modifierSymbolLock@m
- これらの~memberは、 %~event の`内部~UIkey修飾~状態$を[ 対応する`~UIkey修飾~名$ — すなわち、 ~member名を `modifierXXX^c とするときの,文字列 %XXX — を引数に %~event 上の `getModifierState()^m が呼出されたときは, その~member値が返される ]ように初期化する。
3.5.4. `KeyboardEvent^I 用の~algo
3.5.4.1. `KeyboardEvent^I 用の大域的な状態
~UAは、 ~UA全体で共有される値をとして,次を保守するモノトスル:
-
`修飾~UIkey状態@ ⇒ ~systemにて可用な各[ %名前 ~IN { `Shift^l, `Control^l, `Alt^l, `AltGraph^l, `Meta^l } で識別される`修飾~UIkey$ ]の現在の状態を追跡し続ける。
`修飾~UIkey状態$( %名前 ) と記された所では、 %名前 で識別される修飾~UIkeyは[ 押されているならば ~T / ~ELSE_ ~F ]を返すとする。 【この記法は、他所を簡潔に述べるためのこの訳による追加。】
3.5.5. ~keyboard~event序列
この仕様にて定義される~keyboard~eventは、 与えられたどの~UIkeyに対しても,相互相対順序の下で生じる: ◎ The keyboard events defined in this specification occur in a set order relative to one another, for any given key:
| ~event型 | 備考 | |
|---|---|---|
| 1. | `keydown$et | |
| 2. | `beforeinput$et | (`文字~値$を生産する~UIkeyに対してのみ) ◎ (only for keys which produce a character value) |
| この~UIkeyに関係する`既定~動作$ — 文字を~DOMの中へ挿入するなど — があれば,それが行われる。 ◎ Any default actions related to this key, such as inserting a character in to the DOM. | ||
| 3. | `input$et | (~DOMを更新させた~UIkeyに対してのみ) ◎ (only for keys which have updated the DOM) |
| 一定時間,~UIkeyが押下げられたとき、 生じ得るような~event(下を見よ)。 ◎ Any events as a result of the key being held for a sustained period (see below). | ||
| 4. | `keyup$et |
一定時間,~UIkeyが押下げられた場合、 環境に依存する~rateで,次の~eventが繰返されてもヨイ: ◎ If the key is depressed for a sustained period, the following events MAY repeat at an environment-dependent rate:
| ~event型 | 備考 | |
|---|---|---|
| 1. | `keydown$et | ( `KeyboardEvent.repeat$m 属性は ~T に設定される) ◎ (with repeat attribute set to true) |
| 2. | `beforeinput$et | (`文字~値$を生産した~UIkeyに対してのみ) ◎ (only for keys which produce a character value) |
| 【!複製】 この~UIkeyに関係する`既定~動作$ — 文字を~DOMの中へ挿入するなど — があれば,それが行われる。 ◎ Any default actions related to this key, such as inserting a character in to the DOM. | ||
| 3. | `input$et | 【!複製】 (~DOMを更新させた~UIkeyに対してのみ) ◎ (only for keys which have updated the DOM) |
注記: 概して、 特定0の~UIkeyに結付けられた`既定~動作$があれば, `keyup$et ~eventが発火される前に完了する。 これは `keyup$et ~eventを少しばかり遅延し得る (おそらく,知覚される程の遅延にはならないであろうが)。 ◎ Typically, any default actions associated with any particular key are completed before the keyup event is dispatched. This might delay the keyup event slightly (though this is not likely to be a perceptible delay).
~UIkey~eventの`~target$は、 ~keyboard活動を処理している現在の被focus要素である。 これは、[ ~HTML `input^e 要素/編集-可能な~textな要素 ]になることが多いが、 `~host言語$における非~text目的の~keyboard入力 — 加速~UIkeyの作動化や 一部の他の挙動の誘発など — を受容するように定義された要素になることもある。 相応しい被focus要素が無い場合の~event~targetは、[ 可用なら~HTML`~body要素$ / 他の場合は`根~要素$ ]になる。 ◎ The event target of a key event is the currently focused element which is processing the keyboard activity. This is often an HTML input element or a textual element which is editable, but MAY be an element defined by the host language to accept keyboard input for non-text purposes, such as the activation of an accelerator key or trigger of some other behavior. If no suitable element is in focus, the event target will be the HTML body element if available, otherwise the root element.
注記: `~event~target$は、 一連の~UIkey~event間で変化し得る。 例えば, `Tab^cap ~UIkey用の `keydown$et ~eventの`~target$は、 同じ~keystroke用の `keyup$et ~eventと異なるであろう。 ◎ The event target might change between different key events. For example, a keydown event for the Tab key will likely have a different event target than the keyup event on the same keystroke.
3.5.6. 各種~keyboard~event型
3.5.6.1. `keydown^et
文脈依存:
- `beforeinput$et & `input$et ~event
- `~text組成~system$を立上げる
- `blur$et & `focus$et ~event
- `keypress$et ~event(~support有りなら)
- `作動化の挙動$
- その他の~event
~UAは、[ ~UIkeyが押された ]とき,この~eventを発火するモノトスル。 `keydown$et ~event型は装置~依存であり, 入力~装置の能力, および それらが~OSにおいて対応付けられている方法に依拠する。 この~event型は、 `~UIkey対応付け$の後に生成するモノトスル。 この~event型は、 同じ~UIkeyに結付けられた[ `beforeinput$et, `input$et, `keyup$et ]~eventの前に配送するモノトスル。 ◎ A user agent MUST dispatch this event when a key is pressed down. The keydown event type is device dependent and relies on the capabilities of the input devices and how they are mapped in the operating system. This event type MUST be generated after the key mapping. This event type MUST be dispatched before the beforeinput, input, and keyup events associated with the same key.
`keydown$et ~eventの既定~動作は,~UIkeyに依存する: ◎ The default action of the keydown event depends upon the key:
- ~UIkeyが文字に結付けられた場合の既定~動作は、[ `beforeinput$et ~event, 後続する `input$et ~event ]を発火するモノトスル。 ~UIkeyが複数の文字に結付けられた場合 (~macroを伴うものや ~dead-keyからなる連列など) の既定~動作は、 各~文字に対し[ `beforeinput$et, `input$et ]~event対を発火するモノトスル。 ◎ If the key is associated with a character, the default action MUST be to dispatch a beforeinput event followed by an input event. In the case where the key which is associated with multiple characters (such as with a macro or certain sequences of dead keys), the default action MUST be to dispatch one set of beforeinput / input events for each character
- ~UIkeyが`~text組成~system$に結付けられた場合の既定~動作は、 その~systemを立上げるモノトスル。 ◎ If the key is associated with a text composition system, the default action MUST be to launch that system
- ~UIkeyが `Tab^cap ~UIkeyの場合の既定~動作は、 `~focus~event$型にて述べたとおり,文書~focusを現在の被focus要素(もしあれば)から新たな被focus要素へ移転するモノトスル。 ◎ If the key is the Tab key, the default action MUST be to shift the document focus from the currently focused element (if any) to the new focused element, as described in Focus Event Types
- ~UIkeyが `Enter^cap / `~SPACEBAR^cap ~UIkeyであって, かつ 現在の~focusが状態~変化-中にある要素~上にある場合の既定~動作は、[ `click$et ~eventに加えて,~UAが~supportするならば `DOMActivate$et ~event ]を発火するモノトスル。 ◎ If the key is the Enter or (Space) key and the current focus is on a state-changing element, the default action MUST be to dispatch a click event, and a DOMActivate event if that event type is supported by the user agent.
この~eventが取消された場合、[ 結付けられた~event型は発火しないことに加え, 結付けられた動作も遂行しない ]モノトスル。 ◎ If this event is canceled, the associated event types MUST NOT be dispatched, and the associated actions MUST NOT be performed.
注記: [ `keydown$et / `keyup$et ]~eventは、 伝統的に[ `文字~値$を生産する~UIkeyに限らず,他の~UIkeyの検出-法 ]にも結付けられる。 ◎ The keydown and keyup events are traditionally associated with detecting any key, not just those which produce a character value.
3.5.6.2. `keyup^et
~UAは、[ ~UIkeyが離された ]とき,この~eventを発火するモノトスル。 `keyup$et ~event型は装置~依存であり, 入力~装置の能力, および それらが~OSにおいて対応付けられている方法 に依拠する。 この~event型は,`~UIkey対応付け$の後に生成するモノトスル。 この~event型は、 同じ~UIkeyに結付けられた[ `keydown$et, `beforeinput$et, `input$et ]~eventの後に発火するモノトスル。 ◎ A user agent MUST dispatch this event when a key is released. The keyup event type is device dependent and relies on the capabilities of the input devices and how they are mapped in the operating system. This event type MUST be generated after the key mapping. This event type MUST be dispatched after the keydown, beforeinput, and input events associated with the same key.
注記: [ `keydown$et / `keyup$et ]~eventは、 伝統的に[ `文字~値$を生産する~UIkeyに限らず,他の~UIkeyの検出-法 ]にも結付けられる。 ◎ The keydown and keyup events are traditionally associated with detecting any key, not just those which produce a character value.
各種~keyboard~eventに共通な文脈~情報
集約簡略化~keyboard~eventに共通な文脈~情報を以下に挙げる。 個々の~event型にて定義されるものは、 これらより優先される:
- `target$m
- ~UIkey~eventを処理している被focus要素。 被focus要素がない場合、 可用ならば`~body要素$ / 他の場合 `根~要素$ ◎ Event.target : focused element processing the key event or if no element focused, then the body element if available, otherwise the root element
- `UIEvent!I の各~属性:
- `§ 各種~UI~eventに共通な文脈~情報$を見よ。
- `KeyboardEvent!I :
-
- `key$m
- 押された~UIkeyの`~UIkey値$。 ◎ KeyboardEvent.key : the key value of the key pressed.
- `code$m
- ~UIkeyの~keyboard上での物理的~~位置に結付けられた~code値 ◎ KeyboardEvent.code : the code value associated with the key’s physical placement on the keyboard.
- `location$m
- 装置~上の~UIkeyの所在。 ◎ KeyboardEvent.location : the location of the key on the device.
- `altKey$m
- `Alt^cap 修飾が作動中であったなら ~T / 他の場合 ~F ◎ KeyboardEvent.altKey : true if Alt modifier was active, otherwise false
- `shiftKey$m
- `Shift^cap 修飾が作動中であったなら ~T / 他の場合 ~F ◎ KeyboardEvent.shiftKey : true if Shift modifier was active, otherwise false
- `ctrlKey$m
- `Control^cap 修飾が作動中であったなら ~T / 他の場合 ~F ◎ KeyboardEvent.ctrlKey : true if Control modifier was active, otherwise false
- `metaKey$m
- `Meta^cap 修飾が作動中であったなら ~T / 他の場合 ~F ◎ KeyboardEvent.metaKey : true if Meta modifier was active, otherwise false
- `repeat$m
- ~UIkeyの繰返nを誘発するに十分~長く~UIkeyが押下げられているならば ~T / 他の場合 ~F ◎ KeyboardEvent.repeat : true if a key has been depressed long enough to trigger key repetition, otherwise false
- `isComposing$m
- ~UIkey~eventが,組成~sessionの一部として生じたならば ~T / 他の場合 ~F ◎ KeyboardEvent.isComposing : true if the key event occurs as part of a composition session, otherwise false
3.6. 組成~event
`組成~event@ ( `Composition Events^en )は、 ~~普通の~keyboardには無い文字を利用することを許容するために, `~keyboard~event$による方式に[ 補足的な, あるいは代替する ]方式で,~textを入力する手段を供する。 組成~eventは、 例えば,次のために利用され得る:
- 文字に標準的な~US~keyboardには無い~accentを追加する。
- 多くのアジア圏の言語において,基底~成分/字種から表語文字を築上げる。
- 携帯~機器~keyboardで,押されている~UIkeyの組合nから 単語を選択する。
- 発話~認識~処理器を利用して,一連の~voice~commandを~textに変換する。
`組成~event$を~keyboard~eventと組合せる用例については、 `§ ~keyboard~eventと~UIkey値$を見よ。
◎ Composition Events provide a means for inputing text in a supplementary or alternate manner than by Keyboard Events, in order to allow the use of characters that might not be commonly available on keyboard. For example, Composition Events might be used to add accents to characters despite their absence from standard US keyboards, to build up logograms of many Asian languages from their base components or categories, to select word choices from a combination of key presses on a mobile device keyboard, or to convert voice commands into text using a speech recognition processor. Refer to § 4 Keyboard events and key values for examples on how Composition Events are used in combination with keyboard events.概念的には、 組成~sessionは[ 1 個の `compositionstart$et ~event, 1 個【 0 個?】以上の `compositionupdate$et ~event, 1 個の `compositionend$et ~event ]からなり、 それらの~eventの `CompositionEvent.data$m 属性の値は, 各~sessionの最中のこの~event連鎖【伝播?連列?】の各 “stage” 間で持続する【?】。 ◎ Conceptually, a composition session consists of one compositionstart event, one or more compositionupdate events, and one compositionend event, with the value of the data attribute persisting between each "stage" of this event chain during each session.
注記: 組成~sessionで利用されている入力~装置が~keyboardである場合、 組成~sessionが作動中にある間の~keyboard~eventは,~DOMへ発火され得る。 関連な~eventたちの順序付けについては、 `compositionstart$et の詳細, `§ ~IME@#keys-IME$を見よ。 ◎ Note: While a composition session is active, keyboard events can be dispatched to the DOM if the keyboard is the input device used with the composition session. See the compositionstart event details and IME section for relevent event ordering.
`~IME$~system/装置は,~DOMに必要yな~dataを公開するとは限らないので、 作動中な組成~文字列 ( “変換窓( `Reading Window^en )” や “候補~選択~menuに示されるもの” ) は,この~interfaceを通して可用でないこともある — その場合、 選択は`空~文字列$として表現されることもある。 ◎ Not all IME systems or devices expose the necessary data to the DOM, so the active composition string (the "Reading Window" or "candidate selection menu option") might not be available through this interface, in which case the selection MAY be represented by the empty string.
3.6.1. `CompositionEvent^I ~interface
この仕様にて導入された。 ◎ Introduced in this specification
`CompositionEvent^I ~interfaceは、 `組成~event$に特有な文脈l情報を供する。 ◎ The CompositionEvent interface provides specific contextual information associated with Composition Events.
`CompositionEvent^I ~interfaceの~instanceを作成するためには、 その構築子に `CompositionEventInit^I 辞書(省略可能)を渡して呼び出す。 ◎ To create an instance of the CompositionEvent interface, use the CompositionEvent constructor, passing an optional CompositionEventInit dictionary.
3.6.1.1. `CompositionEvent^I
[`Exposed$=Window]
interface `CompositionEvent@I : `UIEvent$I {
`CompositionEvent@mc(`DOMString$ %type, optional `CompositionEventInit$I %eventInitDict = {});
readonly attribute `USVString$ `data$m;
};
- `data@m ◎ data, of type USVString, readonly
- `data^c は~IMEにより生成された一連の`文字~値$を保持する — `空~文字列$にもなり得る。 一連の文字は、[ `UAX15$r にて定義される~Unicode正規化~形 `NFC^em ]による定義に従って正規化されるベキである。 ◎ data holds the value of the characters generated by an input method. This MAY be a single Unicode character or a non-empty sequence of Unicode characters [Unicode]. Characters SHOULD be normalized as defined by the Unicode normalization form NFC, defined in [UAX15]. This attribute MAY be the empty string.
- `未初期化~値$: `空~文字列$ ◎ The un-initialized value of this attribute MUST be "" (the empty string).
3.6.1.2. `CompositionEventInit^I
dictionary `CompositionEventInit@I : `UIEventInit$I {
`DOMString$ `data@m = "";
};
この辞書の各~memberは、 `CompositionEvent!I ~obj上の同じ名前の属性を初期化する。 それぞれがとり得る値とその意味については、 その~interface定義の記述を見よ。 ◎ data, of type DOMString, defaulting to "" • Initializes the data attribute of the CompositionEvent object to the characters generated by the IME composition.
3.6.2. 組成~event序列
この仕様にて定義される`組成~event$は、 次による相互相対順序の下で生じるモノトスル: ◎ The Composition Events defined in this specification MUST occur in the following set order relative to one another:
| ~event型 | 備考 | |
|---|---|---|
| 1. | `compositionstart$et | |
| 2. | `compositionupdate$et | 複数回 生じ得る ◎ Multiple events |
| 3. | `compositionend$et |
3.6.3. 手書き認識~system
次の例に、[ ~pen~tabletなどの手書き認識~systemの下で,一節の~text "text" を組成する ]ときにアリな~event連列を,`組成~event$の~modelを利用して述べる。 ◎ The following example describes a possible sequence of events when composing a text passage "text" with a handwriting recognition system, such as on a pen tablet, as modeled using Composition Events.
| ~event型 | `CompositionEvent.data$m | 備考 | |
|---|---|---|---|
| 1. | `compositionstart$et | `^kGl | |
| 利用者が~tablet表面に単語を書いた ◎ User writes word on tablet surface | |||
| 2. | `compositionupdate$et | `test^kGl | |
| 利用者が~~候補として最初に挙げられた単語を却下して,異なる~~候補を選択した ◎ User rejects first word-match suggestion, selects different match | |||
| 3. | `compositionupdate$et | `text^kGl | |
| 4. | `compositionend$et | `text^kGl |
3.6.4. 組成~eventの取消~法
`keydown$et ~eventが取消された場合、 その `keydown$et の結果として発火されることになる どの`組成~event$も,発火されるベキでない: ◎ If a keydown event is canceled then any Composition Events that would have fired as a result of that keydown SHOULD not be dispatched:
| ~event型 | 備考 | |
|---|---|---|
| 1. | `keydown$et | `既定~動作$は、 例えば `preventDefault()$m の呼出ngにより,防止された。 ◎ The default action is prevented, e.g., by invoking preventDefault(). |
| `組成~event$は発火されない。 ◎ No Composition Events are dispatched | ||
| 2. | `keyup$et |
初期 `compositionstart$et ~eventが取消された場合、 ~text組成~sessionは,終了されるベキである。 `compositionend$et ~eventは、 組成~sessionが終了されたかどうかに関わらず,送信するモノトスル。 ◎ If the initial compositionstart event is canceled then the text composition session SHOULD be terminated. Regardless of whether or not the composition session is terminated, the compositionend event MUST be sent.
| ~event型 | 備考 | |
|---|---|---|
| 1. | `keydown$et | |
| 2. | `compositionstart$et | 【!複製】 `既定~動作$は、 例えば `preventDefault()$m の呼出ngにより,防止された。 ◎ The default action is prevented, e.g., by invoking preventDefault(). |
| 【!複製】 `組成~event$は発火されない。 ◎ No Composition Events are dispatched | ||
| 3. | `compositionend$et | |
| 4. | `keyup$et |
3.6.5. 組成~時における~UIkey~event
組成~sessionの最中でも、 依然として[ `keydown$et, `keyup$et ]~eventは送信するモノトスル — その `KeyboardEvent.isComposing$m 属性は ~T になるモノトスル。 ◎ During the composition session, keydown and keyup events MUST still be sent, and these events MUST have the isComposing attribute set to true.
| ~event型 | `KeyboardEvent.isComposing$m | 備考 | |
|---|---|---|---|
| 1. | `keydown$et | ~F | これが組成を起動した~UIkey~eventである。 ◎ This is the key event that initiates the composition. |
| 2. | `compositionstart$et | ||
| 3. | `compositionupdate$et | ||
| 4. | `keyup$et | ~T | |
| ... | 組成~sessionの最中に送信された どの~UIkey~eventも, `KeyboardEvent.isComposing$m は ~T に設定するモノトスル。 ◎ Any key events sent during the composition session MUST have isComposing set to true. | ||
| 5. | `keydown$et | ~T | これが組成を終わらせた~UIkey~eventである。 ◎ This is the key event that exits the composition. |
| 6. | `compositionend$et | ||
| 7. | `keyup$et | ~F |
3.6.6. 組成~sessionの間の入力~event
組成~sessionの間は、 その `compositionupdate$et は, `beforeinput$et が送信された後, かつ `input$et が送信される前に発火するモノトスル。 ◎ During the composition session, the compositionupdate MUST be dispatched after the beforeinput is sent, but before the input event is sent.
| ~event型 | 備考 | |
|---|---|---|
| 1. | `beforeinput$et | |
| 2. | `compositionupdate$et | |
| ~DOMの更新はこの時点で生じる。 ◎ Any DOM updates occur at this point. | ||
| 3. | `input$et |
注記: ほとんどの~IMEは、 組成~sessionの間における更新の取消~法は~supportしない。 ◎ Most IMEs do not support canceling updates during a composition session.
[ `beforeinput$et / `input$et ]~eventは、 組成の一部として~DOMが更新されるときに, `compositionupdate$et ~eventに伴って送信される。 `compositionend$et ~eventに対しては,~DOMの更新はないので、[ `beforeinput$et / `input$et ]~eventは送信されるべきではない。 ◎ The beforeinput and input events are sent along with the compositionupdate event whenever the DOM is updated as part of the composition. Since there are no DOM updates associated with the compositionend event, beforeinput and input events should not be sent at that time.
| ~event型 | 備考 | |
|---|---|---|
| 1. | `beforeinput$et | これを取消したときは ~DOM更新と `input$et ~eventを防止することになる。 ◎ Canceling this will prevent the DOM update and the input event. |
| 2. | `compositionupdate$et | |
| ~DOMの更新はこの時点で生じる。 ◎ Any DOM updates occur at this point. | ||
| 3. | `input$et | ~DOMが更新された場合に限り送信される。 ◎ Sent only if the DOM was updated. |
| 4. | `compositionend$et |
3.6.7. 各種~組成~event型
3.6.7.1. `compositionstart^et
次に挙げるものを除き, `§ 各種~組成~eventに共通な文脈~情報$ を見よ:
- `CompositionEvent.data$m: 編集-中にある【!元の】文字列, または`空~文字列$
~UAは、 `~text組成~system$が可能化されている下で,[ ~textの一節を組成する準備として,新たな組成~sessionが始まりつつある (または,`~text組成~system$に依存して始まった) ]とき,この~eventを発火するモノトスル。 この~event型は、 装置に依存し,[ ~text変換~systemの能力, ~OSの中へ対応付けられる方法 ]に依拠することもある。 この~event型は、 ~IMEへの~~入力が~keyboardから投入された場合は, `keydown$et ~eventの後に生成されるが、[ 発話/手書き ]認識~systemにおいては ~keyboard~eventを伴わずに送信されてもヨイ。 実装は、 `compositionstart$et ~eventの `CompositionEvent.data$m 属性を[ 文書にて現在(編集/置換~用に)選択されている~text ]で拡充してもヨイ — そうしない場合、 `空~文字列$にするモノトスル。 ◎ A user agent MUST dispatch this event when a text composition system is enabled and a new composition session is about to begin (or has begun, depending on the text composition system) in preparation for composing a passage of text. This event type is device-dependent, and MAY rely upon the capabilities of the text conversion system and how it is mapped into the operating system. When a keyboard is used to feed an input method editor, this event type is generated after a keydown event, but speech or handwriting recognition systems MAY send this event type without keyboard events. Some implementations MAY populate the data attribute of the compositionstart event with the text currently selected in the document (for editing and replacement). Otherwise, the value of the data attribute MUST be the empty string.
この~eventは、 `~text組成~system$が新たな組成~sessionを始める直前に, かつ 組成~処理により~DOMが改変される前に,発火するモノトスル。 この~eventの,`~text組成~system$用の既定~動作は、 新たな組成~sessionを開始させる。 この~eventが取消された場合、 `~text組成~system$は,現在の組成~sessionを破棄するベキである。 ◎ This event MUST be dispatched immediately before a text composition system begins a new composition session, and before the DOM is modified due to the composition process. The default action of this event is for the text composition system to start a new composition session. If this event is canceled, the text composition system SHOULD discard the current composition session.
注記: `compositionstart$et ~eventを取消すことと,`~text組成~system$自身を取消すこと (例: 取消~buttonを叩いたり, `~IME$ ~UIwindowを閉じるなど) とは、 別物である。 ◎ Canceling the compositionstart event type is distinct from canceling the text composition system itself (e.g., by hitting a cancel button or closing an IME window).
注記: ~IMEには、 進捗-中にある組成~sessionの取消~法を~supportしないものもある (例: GTK などは,~~現時点ではそのような~APIを備えていない)。 そのような事例では、 `preventDefault()$m を~callしても,この~eventの既定~動作は停止されないことになる。 ◎ Some IMEs do not support cancelling an in-progress composition session (e.g., such as GTK which doesn’t presently have such an API). In these cases, calling preventDefault() will not stop this event’s default action.
3.6.7.2. `compositionupdate^et
次に挙げるものを除き, `§ 各種~組成~eventに共通な文脈~情報$ を見よ:
- `CompositionEvent.data$m: 組成~sessionの現在の結果を成す文字列 — 内容が削除された場合、 `空~文字列$になることもある。
~UAは、[ 組成~sessionの最中に,`~text組成~system$が その作動中な~text一節を新たな文字で更新するとき ]に,この~eventを発火するベキである。 また、 配送するときは, `CompositionEvent.data$m 値にその更新を反映するモノトスル。 ◎ A user agent SHOULD dispatch this event during a composition session when a text composition system updates its active text passage with a new character, which is reflected in the string in data.
[ 進行中な組成と入力~controlとの同期cを保つ ]ような `~text組成~system$においては、 `compositionupdate$et ~eventは,その~controlが更新される前に配送するモノトスル。 ◎ In text composition systems which keep the ongoing composition in sync with the input control, the compositionupdate event MUST be dispatched before the control is updated.
`~text組成~system$には、 この情報を~DOMに公開しないものもある — その場合、 この~eventは,組成~処理nの最中には発火されないことになる。 ◎ Some text composition systems might not expose this information to the DOM, in which case this event will not fire during the composition process.
組成~sessionが取消された場合、 この~eventは, `compositionend$et ~eventの直前に — その `CompositionEvent.data$m 属性を`空~文字列$に設定した上で — 発火されることになる。 ◎ If the composition session is canceled, this event will be fired immediately before the compositionend event, and the data attribute will be set to the empty string.
3.6.7.3. `compositionend^et
次に挙げるものを除き, `§ 各種~組成~eventに共通な文脈~情報$ を見よ:
- `CompositionEvent.data$m: 組成~sessionの最終的な結果を成す文字列 — [ 内容が削除された/組成~処理nが取消された ]場合、 `空~文字列$になることもある。
~UAは、[ `~text組成~system$が 現在の組成~sessionを 完了した, または取消された ]とき,この~eventを発火するモノトスル。 この~eventは、 ~controlが更新された後に配送するモノトスル。 ◎ A user agent MUST dispatch this event when a text composition system completes or cancels the current composition session, and the compositionend event MUST be dispatched after the control is updated.
この~eventは、 `~text組成~system$が組成~sessionを完了した直後に配送される (例: `~IME$が[ 閉じられた / 最小~化された / ~focusが他へ切替えられた / その他~退けられた ]後に,~focusが~~元の~UAに切替わったときなど)。 ◎ This event is dispatched immediately after the text composition system completes the composition session (e.g., the IME is closed, minimized, switched out of focus, or otherwise dismissed, and the focus switched back to the user agent).
各種~組成~eventに共通な文脈~情報
集約簡略化多くの組成~eventに共通な文脈~情報を以下に挙げる。 個々の~event型にて定義されるものは、 これらより優先される:
- `target$m
- 組成を処理している被focus要素。 ~access可能でないならば~NULL。 ◎ Event.target : focused element processing the composition, null if not accessible
- `UIEvent!I の各~属性:
- `§ 各種~UI~eventに共通な文脈~情報$を見よ。
4. ~keyboard~eventと~UIkey値
この節では、 ~keyboard~eventに関して必要yな情報を与える: ◎ This section contains necessary information regarding keyboard events:
- ~keyboard~layout, `~UIkey対応付け$, `~UIkey値$ についての説明。 ◎ Explanation of keyboard layout, mapping, and key values.
- `~dead-key$や修飾~UIkeyなどの、 ~UIkeyどうしの関係。 ◎ Relations between keys, such as dead keys or modifiers keys.
- ~keyboard~eventとその既定~動作との関係。 ◎ Relations between keyboard events and their default actions.
- `key^m 値の集合, および この集合を拡張する方法についての指針。 ◎ The set of key values, and guidelines on how to extend this set.
注記: この節では、 ~Serbianと漢字を利用する。 【!which could be misrepresented or unavailable...】 ◎ This section uses Serbian and Kanji characters which could be misrepresented or unavailable in the PDF version or printed version of this specification.
4.1. ~keyboard入力
◎非規範的完全な~keyboardの各~UIkeyの関係性には,次に挙げる別々な側面があり、 いずれも — 特に,~localeに特有な理由で — ~keyboard機種や環境設定により様々になる: ◎ The relationship of each key to the complete keyboard has three separate aspects, each of which vary among different models and configurations of keyboards, particularly for locale-specific reasons:
- 物理的0な~layout: ~keyboard上での物理的な~UIkeyの 寸法, ~size, ~~配置 ◎ Mechanical layout: the dimensions, size, and placement of the physical keys on the keyboard
- 視覚的な目印: 各~UIkeyを印字する~label(または `銘^em) ◎ Visual markings: the labels (or legends) that mark each key
- 機能上の`~UIkey対応付け$: 各~UIkey用の抽象的な ~UIkey ↔ 値の結付け。 ◎ Functional mapping: the abstract key-value association of each key.
この仕様は、 `key^m 値 および `code^m 値 を通して,機能上の`~UIkey対応付け$のみを定義するが、 背景0として, `~UIkey銘@#key-legends$についても概括する。 ◎ This specification only defines the functional mapping, in terms of key values and code values, but briefly describes key legends for background.
4.1.1. ~UIkey銘
◎非規範的~UIkey銘( `key legend^en )とは、 その `~UIkey~cap^em (~UIkeyの物理的0な~switchを覆う “~cap” ) 上に印刷されたり, 彫り込まれている,視覚的な目印である。 この種の目印は、 通常は,その~UIkeyに対する~keystrokeが生産するような 1 個~以上の文字からなる(例: `G^kGl, `8^kGl, `ш^kGl ), あるいは その~UIkeyの機能を指示する名前や記号 (例: `Shift^cap を指示する上向き矢印 `⇧^kGl, 文字列 "Enter" など)。 ~UIkeyは、 この目印で指されることが多い (例: “ Shift + F ~UIkeyを押してください。” )。 しかしながら、 ~UIkeyの視覚的な見かけは,その~digital表現とは~~関係ないものであり、 多くの環境設定で,まったく正確aでないものにもなり得る。 `Enter^cap などの[ 制御~UIkey/~function~UIkey ]であっても,[ 機能性が異なるものや文字~UIkey ]に対応付けられることすら あり得る。 ◎ The key legend is the visual marking that is printed or embossed on the key cap (the rectangular "cap" that covers the mechanical switch for the key). These markings normally consist of one or more characters that a keystroke on that key will produce (such as "G", "8", or "ш"), or names or symbols which indicate that key’s function (such as an upward-pointing arrow "⇧" indicating Shift, or the string "Enter"). Keys are often referred to by this marking (e.g., "Press the "Shift" and "G" keys."). Note, however, that the visual appearance of the key has no bearing on its digital representation, and in many configurations may be completely inaccurate. Even the control and function keys, such as Enter, may be mapped to different functionality, or even mapped as character keys.
注記: 多くの~keyboardは、 ~Unicode等価な記号があっても,通常は文字を生産しない~UIkeyを備えている。 例えば, `Shift^cap ~UIkeyには、 記号 `⇧^kGl (~Unicode符号位置 `21E7^U )が付けられることもあるが, `Shift^cap ~UIkeyだけ押しても この`文字~値$を生産することはないし, `Shift^cap に対応する~Unicode符号位置もない。 ◎ Many keyboards contain keys that do not normally produce any characters, even though the symbol might have a Unicode equivalent. For example, the Shift key might bear the symbol "⇧", which has the Unicode code point U+21E7, but pressing the Shift key will not produce this character value, and there is no Unicode code point for Shift.
4.2. ~UIkey~code
~keyboard~eventに結付けられた物理的~UIkeyを識別するときは、 ~keyboard~eventの `code$m 属性で指示される~UIkey~codeを利用できる。 それは、 USB Usage ID に類似な, ~vendor中立な, 低~levelな(~scancodeに類似な)値を供する。 ◎ A key code is an attribute of a keyboard event that can be used to identify the physical key associated with the keyboard event. It is similar to USB Usage IDs in that it provides a low-level value (similar to a scancode) that is vendor-neutral.
`code$m 属性の首な目的は、 ~UIkeyを その物理的~所在に基づいて識別するための,首尾一貫する仕方を供することである。 加えて、 ~keyboardの各~UIkeyに(現在の~keyboard状態に影響されないような)安定的な名前も供して,それらを一意に識別する。 ◎ The primary purpose of the code attribute is to provide a consistent and coherent way to identify keys based on their physical location. In addition, it also provides a stable name (unaffected by the current keyboard state) that uniquely identifies each key on the keyboard.
妥当な `code^m 値たちが成す~listは、 `UIEvents-Code$r にて定義される。 ◎ The list of valid code values is defined in the [UIEvents-Code].
4.2.1. `code^m 属性の動機
標準的な~PC~keyboardが備えている一群の~UIkeyが生成する `key$m 値は、 利用者が現在~選択している(利用している書記体系に適切な)~keyboard~layoutにより異なる。 このような状況では、 ~UIkeyをその物理的~所在に基づいて検出するような~codeを書くことは困難になる — ~codeが,どの `key^m 値を検査すればよいか知るためには、 現在~有効な~layoutがどれなのかを知る必要があるので。 現実の例として、 ~playerの動きを制御するために[ `W^kGl, `A^kGl, `S^kGl, `D^kGl ]~UIkeyを利用する~gameがある。 `code$m 属性は、 それを検査するための,`現在の~keyboard~layoutに影響されない^em, 安定的な値を供して、 この問題を解消する。 ◎ The standard PC keyboard has a set of keys (which we refer to as writing system keys) that generate different key values based on the current keyboard layout selected by the user. This situation makes it difficult to write code that detects keys based on their physical location since the code would need to know which layout is in effect in order to know which key values to check for. A real-world example of this is a game that wants to use the "W", "A", "S" and "D" keys to control player movement. The code attribute solves this problem by providing a stable value to check that is not affected by the current keyboard layout.
加えて、 `key$m 属性がとる値は,現在の~keyboard状態にも依存する。 このため、 修飾~UIkeyと他の~UIkeyが[ 押される/離される ]順序も, `key$m 属性に格納される値に影響し得る。 `code$m 属性は、 `現在の~keyboard~layoutに影響されない^em, 安定的な値を供して、 この問題を解消する。 ◎ In addition, the values in the key attribute depend as well on the current keyboard state. Because of this, the order in which keys are pressed and released in relation to modifier keys can affect the values stored in the key attribute. The code attribute solves this problem by providing a stable value that is not affected by the current keyboard state.
4.2.2. `key^m と `code^m の関係性
- `key^m
- `key$m 属性に意図されている用途は、 押されている~UIkeyの意味に基づくふるまいを得ることである — その値には、 現在の~keyboard~layoutに加えて,~IMEも織り込まれる (`~dead-key@#keys-dead$ には,一意な `key^m 値が与えられる)。 例えば、[ ~UIkeyが修飾~UIkeyを伴うかどうかや ~~素の修飾~UIkey ]を検出する利用事例がある (例:~keyboard~shortcutに呼応して何らかの動作を遂行するためなど)。 ◎ The key attribute is intended for users who are interested in the meaning of the key being pressed, taking into account the current keyboard layout (and IME; dead keys are given a unique key value). Example use case: Detecting modified keys or bare modifier keys (e.g., to perform an action in response to a keyboard shortcut).
- `code^m
- `code$m 属性に意図されている用途は、 利用者により押された~UIkeyそのもの — ~keyboard~layoutにより改変されないままの~UIkey — に基づくふるまいを得ることである。 例えば、 ~gameにおける動き制御~用に[ `W^cap, `A^cap, `S^cap, `D^cap ]~UIkeyを検出したり、 すべての~UIkeyを~trapする (例: すべての~UIkeyを~remote~hostに送信する~remote~desktop~client) などの利用事例がある。 ◎ The code attribute is intended for users who are interested in the key that was pressed by the user, without any layout modifications applied. Example use case: Detecting WASD keys (e.g., for movement controls in a game) or trapping all keys (e.g., in a remote desktop client to send all keys to the remote host).
4.2.3. ~code例
左右 Alt ~UIkeyの取扱い: ◎ Handling the Left and Right Alt Keys
| Keyboard Layout | `key$m | `code$m | 備考 |
|---|---|---|---|
| US | `Alt$kY | `AltLeft$kC | `DOM_KEY_LOCATION_LEFT^m |
| ~French | `Alt$kY | `AltLeft$kC | `DOM_KEY_LOCATION_LEFT^m |
| US | `Alt$kY | `AltRight$kC | `DOM_KEY_LOCATION_RIGHT^m |
| ~French | `AltGraph$kY | `AltRight$kC | `DOM_KEY_LOCATION_RIGHT^m |
この例は、[ `key$m 属性を検査すれば,左右どちらの `Alt^cap ~UIkeyが押されたか気にせずに `Alt^cap と照合できる ]ことを示している。 `code$m 属性を検査すれば,現在~有効な~layoutが何かを気にすることなく 右 `Alt^cap ~UIkey( `AltRight$kC )と照合できるようになる。 ◎ In this example, checking the key attribute permits matching Alt without worrying about which Alt key (left or right) was pressed. Checking the code attribute permits matching the right Alt key ("AltRight") without worrying about which layout is currently in effect.
~Frenchの例では、[ `Alt^cap / `AltGraph^cap ]~UIkeyは どちらも 1 個しかないが,それらの[ 左/右 ]の所在は維持されることに注意。 ◎ Note that, in the French example, the Alt and AltGraph keys retain their left and right location, even though there is only one of each key.
Single Quote ~UIkeyの取扱い: ◎ Handling the Single Quote Key
| Keyboard Layout | `key$m | `code$m |
|---|---|---|
| US | `'^kY | `Quote$kC |
| 日本語 | `:^kY | `Quote$kC |
| US Intl | `Dead$kY | `Quote$kC |
この例は、 属性において,~dead-key値がどう符号化されるかを示している。 `key^m 値は,現在の~localeに基づいて様々になる一方、 `code$m 属性は,一貫した値を返す。 ◎ This example shows how dead key values are encoded in the attributes. The key values vary based on the current locale, whereas the code attribute returns a consistent value.
種々の~keyboard~layoutにおける `2^kGl ~UIkeyの取扱い ( Shift も押したとき/押さないとき): ◎ Handling the "2" Key (with and without Shift pressed) on various keyboard layouts.
| Keyboard Layout | `key$m | `code$m | Shift の有無 |
|---|---|---|---|
| US | `2^kY | `Digit2$kC | |
| US | `~aT^kY | `Digit2$kC | `shiftKey$m |
| UK | `2^kY | `Digit2$kC | |
| UK | `"^kY | `Digit2$kC | `shiftKey$m |
| ~French | `é^kY | `Digit2$kC | |
| ~French | `2^kY | `Digit2$kC | `shiftKey$m |
現在の~localeや修飾~UIkey状態に関わらず, ~US~keyboardで~UIkey `2^kGl の~UIkeyを押したときの `code$m 属性の結果は、 常に `Digit2$kC になる。 ◎ Regardless of the current locale or the modifier key state, pressing the key labelled "2" on a US keyboard always results in "Digit2" in the code attribute.
~keyboard~event連列: `Shift^cap & `2^cap ◎ Sequence of Keyboard Events : Shift and 2
次では、 2 つの~UIkey~event連列における属性~値を比較する。 それらは いずれも ~US~keyboardでは 文字 `~aT^kGl を生産するが、 ~UIkeyが離される順序により相違する。 最初の例の連列の順序は: `Shift^cap (押) → `2^cap (押) → `2^cap(離) → `Shift^cap(離)。 ◎ Compare the attribute values in the following two key event sequences. They both produce the "@" character on a US keyboard, but differ in the order in which the keys are released. In the first sequence, the order is: Shift (down), 2 (down), 2 (up), Shift (up).
| ~event型 | `key$m | `code$m | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Shift$kY | `ShiftLeft$kC | `DOM_KEY_LOCATION_LEFT^m |
| 2. | `keydown$et | `~aT^kY | `Digit2$kC | `shiftKey$m |
| 3. | `keypress$et | `~aT^kY | `Digit2$kC | (~support有りなら) |
| 4. | `keyup$et | `~aT^kY | `Digit2$kC | `shiftKey$m |
| 5. | `keyup$et | `Shift$kY | `ShiftLeft$kC | `DOM_KEY_LOCATION_LEFT^m |
次の例の連列は、 2 を離すより先に Shift を離した場合: `Shift^cap(押) → `2^cap(押) → `Shift^cap(離) → `2^cap(離)。 ◎ In the second sequence, the Shift is released before the 2, resulting in the following event order: Shift (down), 2 (down), Shift (up), 2 (up).
| ~event型 | `key$m | `code$m | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Shift$kY | `ShiftLeft$kC | `DOM_KEY_LOCATION_LEFT^m |
| 2. | `keydown$et | `~aT^kY | `Digit2$kC | `shiftKey$m |
| 3. | `keypress$et | `~aT^kY | `Digit2$kC | (~support有りなら) |
| 4. | `keyup$et | `Shift$kY | `ShiftLeft$kC | `DOM_KEY_LOCATION_LEFT^m |
| 5. | `keyup$et | `2^kY | `Digit2$kC |
~UIkey `2^kGl については、 `key$m 属性の値が `keydown$et ~eventと `keyup$et ~eventとの間で合致しないことに注意。 `code$m 属性は、 現在の修飾~状態に影響されず,一貫した値を供する。 ◎ Note that the values contained in the key attribute does not match between the keydown and keyup events for the "2" key. The code attribute provides a consistent value that is not affected by the current modifier state.
4.2.4. `code^m と~virtual~keyboard
`code$m 属性の有用性は、 ~virtual~keyboardに対しては明白でない (~remote-control~keyboardや複数~UIkeyの同時押下げに対しても)。 ~virtual(または~remote-control)~keyboardに対しては、 標準的な~keyboardの ~layout/機能性 を真似ているものについては, `code$m 属性を適切に設定するモノトスル。 真似ていない~keyboardについては、 標準的な~keyboardになるべく近いものに設定するか, または 未定義なままにしてもヨイ。 ◎ The usefulness of the code attribute is less obvious for virtual keyboards (and also for remote controls and chording keyboards). In general, if a virtual (or remote control) keyboard is mimicking the layout and functionality of a standard keyboard, then it MUST also set the code attribute as appropriate. For keyboards which are not mimicking the layout of a standard keyboard, then the code attribute MAY be set to the closest match on a standard keyboard or it MAY be left undefined.
修飾~状態に基づいて異なる値を生産する~UIkeyを伴うような~virtual~keyboardに対しては、 `code^m 値は,[ 装置がその工場出荷~状態にある下で~buttonが押された ]ときに生成される `key^m 値になるベキである。 ◎ For virtual keyboards with keys that produce different values based on some modifier state, the code value should be the key value generated when the button is pressed while the device is in its factory-reset state.
4.3. ~keyboard~eventの `key^m 値
`~UIkey値$は、 ~keyboard上の任意の~UIkeyを — その位置や状態に関わらず — それが生産する値で指示するために利用できる `DOMString^I である。 これらの~UIkey値は、 次に挙げるものに利用できる/され得る:
- 実装により生成される~keyboard~event用の返り値
- 内容~作者から欲される入力(~keyboard~shortcutなど)を指定するための入力~値
妥当な `key^m 値たちが成す~listは `UIEvents-Key$r にて定義される。 ◎ The list of valid key values is defined in [UIEvents-Key].
`~UIkey値$は、 `key$m 属性を利用して,押された~UIkeyの値を検出するときに利用される値である。 内容~作者は、[ 大文字や小文字, 数字n, 記号 ]その他,文字を生産する~UIkeyに対しては その`文字~値$を検索取得でき、[ 制御~UIkey, 修飾~UIkey, ~function~UIkey ]その他,文字を生産しない~UIkeyに対しては その`~UIkey値$を検索取得できる。 これらの値は、[ 特定0の入力~文字列を監視する / 他の入力(~mouseなど)との組合nで 修飾~UIkey入力を検出して動作する / ~virtual~keyboardを作成する ]その他,いくつもの目的に利用できる。 ◎ Key values can be used to detect the value of a key which has been pressed, using the key attribute. Content authors can retrieve the character value of upper- or lower-case letters, number, symbols, or other character-producing keys, and also the key value of control keys, modifier keys, function keys, or other keys that do not generate characters. These values can be used for monitoring particular input strings, for detecting and acting on modifier key input in combination with other inputs (such as a mouse), for creating virtual keyboards, or for any number of other purposes.
内容~作者は、 `~UIkey値$を文字列~比較にも利用できる — 適合`~host言語$における~markup属性~用の値(~HTMLの `accesskey^a など)として, あるいは 他の関係する目的に。 適合`~host言語$は、 `~UIkey値$用の 2 つの等価な文字列~値 — `文字~値$, `~UIkey値$ — どちらも利用できることを内容~作者に許容するベキである。 ◎ Key values can also be used by content authors in string comparisons, as values for markup attributes (such as the HTML accesskey) in conforming host languages, or for other related purposes. A conforming host language SHOULD allow content authors to use either of the two equivalent string values for a key value: the character value, or the key value.
注記: 実装は、 所与の~UIkey用に — ~platformや~keyboard~layout用の`~UIkey対応付け$からは独立に — 最も関連な値を利用することになる一方、 内容~作者は,それらを生成する~keyboard装置の能について前提を置けない。 内容~作者は、 ~shortcut~UIkeyの組合nとして~keyboard~eventと~UIkey値を利用するときには,普通字の代わりに 数字n~UIkey, ~function~UIkey( `F4^cap, `F5^cap, 等々)の利用も考慮できる( `DWW95$r ) — ほとんどの~keyboard~layoutは,それら用の~UIkeyを供するので。 ◎ While implementations will use the most relevant value for a key independently of the platform or keyboard layout mappings, content authors can not make assumptions on the ability of keyboard devices to generate them. When using keyboard events and key values for shortcut-key combinations, content authors can "consider using numbers and function keys (F4, F5, and so on) instead of letters" ([DWW95]) given that most keyboard layouts will provide keys for those.
`~UIkey値$は、 物理的な~keyboard上の特定の~UIkeyを指示するものでも, ~UIkey上に印刷された文字を反映するものでもない。 ~UIkey値は、 作動中な[ ~UIkeyすべて/~UIkey入力~mode(~shift~modeを含む)の現在の状態 ]が考慮に入れられ,~OSによる~keyboard用の`~UIkey対応付け$に反映され, 実装に報告されるような,~eventの現在の値を指示する。 例えば、[ `QWERTY$ ~keyboardの `O^cap ~UIkey ]の~UIkey値は,[ ~shiftなしなら `o^kY / ~shiftありなら `O^kY ]になる。 利用者は,自身の~keyboardを任意な~custom環境設定に対応付けれるので、 内容~作者には,[ ~UIkeyの~shiftの有無と, 文字~表現の[ 大文字形, 小文字形 ]との間に関係性が存在する ]ものと見做すことなく, `key$m 属性の値を利用することが奨励される。 例えば、 `D3E-code$r にて図面化されている標準的な “102 ~keyboard” ~layoutは、 あるアリな~keyboard~layoutにおける,`~UIkey対応付け$が成す集合としてアリな一つを図示する。 他にも、 標準なもの, 独特なものが多数 存在する。 ◎ A key value does not indicate a specific key on the physical keyboard, nor does it reflect the character printed on the key. A key value indicates the current value of the event with consideration to the current state of all active keys and key input modes (including shift modes), as reflected in the operating-system mapping of the keyboard and reported to the implementation. In other words, the key value for the key labeled O on a QWERTY keyboard has the key value "o" in an unshifted state and "O" in a shifted state. Because a user can map their keyboard to an arbitrary custom configuration, the content author is encouraged not to assume that a relationship exists between the shifted and unshifted states of a key and the majuscule form (uppercase or capital letters) and minuscule form (lowercase or small letters) of a character representation, but is encouraged instead to use the value of the key attribute. For example, the Standard "102" Keyboard layout depicted in [UIEvents-Code] illustrates one possible set of key mappings on one possible keyboard layout. Many others exist, both standard and idiosyncratic.
注記: `~dead-key$用の~supportを単純~化するため、 ~OSによる~keyboard用の`~UIkey対応付け$が`~dead-key$状態を取扱うとき, ~dead-key連列の現在の状態は `key$m 属性を介しては報告されず, 代わりに`~UIkey値$ `Dead$kY が報告される。 実装は、 代わりに[ ~dead-key連列の中間的な状態を包含する,一連の`組成~event$ ]を生成して,それを `CompositionEvent.data$m 属性を介して報告する。 前掲の例と同様に,[ `QWERTY$ ~keyboardの `O^cap と印字された~UIkey用の`~UIkey値$には, ~dead-key操作oの最中に~umlaut発音区別符が追加される ]ので、 `CompositionEvent.data$m 値は, ~shiftなしなら `ö^kGl になり, ~shiftありなら `Ö^kGl になる。 ◎ To simplify dead key support, when the operating-system mapping of the keyboard is handling a dead key state, the current state of the dead key sequence is not reported via the key attribute. Rather, a key value of "Dead" is reported. Instead, implementations generate composition events which contain the intermediate state of the dead key sequence reported via the data attribute. As in the previous example, the key value for the key marked O on a QWERTY keyboard has a data value of "ö" in an unshifted state during a dead-key operation to add an umlaut diacritic, and "Ö" in a shifted state during a dead-key operation to add an umlaut diacritic.
また、 ~UIkey~eventの各~状態と各`~UIkey値$との間には, 一対一の関係性はないことにも特に注意。 複数の~UIkeyが特定0の~UIkey値に結付けられることもある。 例えば,多くの標準的な~keyboardは、 `Shift^cap ~UIkeyや `8^cap ~UIkeyを複数~備えている (通常は、 いずれも `location$m 値で判別される — 前者は[ `DOM_KEY_LOCATION_LEFT$m / `DOM_KEY_LOCATION_RIGHT$m ]で,後者は[ `DOM_KEY_LOCATION_STANDARD$m / `DOM_KEY_LOCATION_NUMPAD$m ]で)。 また,利用者により環境設定された~custom~keyboard~layoutは、 どの~UIkey値にも複数の~UIkey状態が対応~付けられ得る ( `location$m は、 標準的な~keyboard~layout~~用途に意図されていることに注意 — 有意義な~~区別を常に指示できるわけではない)。 ◎ It is also important to note that there is not a one-to-one relationship between key event states and key values. A particular key value might be associated with multiple keys. For example, many standard keyboards contain more than one key with the Shift key value (normally distinguished by the location values DOM_KEY_LOCATION_LEFT and DOM_KEY_LOCATION_RIGHT) or 8 key value (normally distinguished by the location values DOM_KEY_LOCATION_STANDARD and DOM_KEY_LOCATION_NUMPAD), and user-configured custom keyboard layouts MAY duplicate any key value in multiple key-state scenarios (note that location is intended for standard keyboard layouts, and cannot always indicate a meaningful distinction).
~~最後に、 与えられた文字~表現の意味は,文脈に依存する上に複階的である。 例えば,一部の文脈では、 ~asterisk~glyph( `*^kGl )は,脚注や強勢を表現する (~textの一節を~~括るとき)。 しかしながら,[ それ/その機能 ]は、 文書や実行-可能な~programによっては, 数学的な乗算に等価であることも, 乗算~記号( `×^kGl, ~Unicode `00D7^U )として予約-済みなことも, ~~英小文字 "x" ( `Latin small letter x^cn )であることもある (多くの~keyboardが乗算~UIkeyを欠くこと,あるいは `×^kGl と `x^kGl のような~glyphの~~外見上の~~類似に因り)。 したがって、[ 意味論上の意味, 文字~表現の機能 ]は,この仕様の視野から外れる。 ◎ Finally, the meaning of any given character representation is context-dependent and complex. For example, in some contexts, the asterisk (star) glyph ("*") represents a footnote or emphasis (when bracketing a passage of text). However, in some documents or executable programs it is equivalent to the mathematical multiplication operation, while in other documents or executable programs, that function is reserved for the multiplication symbol ("×", Unicode value U+00D7) or the Latin small letter "x" (due to the lack of a multiplication key on many keyboards and the superficial resemblance of the glyphs "×" and "x"). Thus, the semantic meaning or function of character representations is outside the scope of this specification.
4.3.1. 修飾~UIkey
修飾~UIkeyを利用する~keyboard入力は、 ~UIkeyの通常の挙動を変化させる。 他の~UIkeyと同様、 修飾~UIkeyは,下の例に示すとおり[ `keydown$et / `keyup$et ]~eventを生成する。 修飾~UIkeyには、 押されている間 作動化されるものもあれば ( `Alt^cap, `Control^cap, `Shift^cap, `AltGraph^cap, `Meta^cap など)、 状態を持ち,その状態に依存して作動化されるものもある ( `CapsLock^cap, `NumLock^cap, `ScrollLock^cap など)。 状態の変化は、 修飾~UIkeyが押されたときに起こる。 `KeyboardEvent!I ~interfaceは、 一部の共通的な修飾~UIkeyに対し,簡便な属性 — `ctrlKey$m, `shiftKey$m, `altKey$m, `metaKey$m — を供する。 一部の~OSは、 修飾~UIkey `AltGraph^cap を,修飾~UIkey `Alt^cap, `Control^cap の組合nで模倣する。 実装には、 `AltGraph^cap 修飾~UIkeyを利用することが奨励される。 ◎ Keyboard input uses modifier keys to change the normal behavior of a key. Like other keys, modifier keys generate keydown and keyup events, as shown in the example below. Some modifiers are activated while the key is being pressed down or maintained pressed such as Alt, Control, Shift, AltGraph, or Meta. Other modifiers are activated depending on their state such as CapsLock, NumLock, or ScrollLock. Change in the state happens when the modifier key is being pressed down. The KeyboardEvent interface provides convenient attributes for some common modifiers keys: ctrlKey, shiftKey, altKey, metaKey. Some operating systems simulate the AltGraph modifier key with the combination of the Alt and Control modifier keys. Implementations are encouraged to use the AltGraph modifier key.
次の例に、 ~US~keyboardで, ~US用の`~UIkey対応付け$を利用している下で, ~Unicode文字 Q( `0051^U `Latin Capital Letter Q^cn ) が生成されるときにアリな~event連列を述べる: ◎ This example describes a possible sequence of events associated with the generation of the Unicode character Q (Latin Capital Letter Q, Unicode code point U+0051) on a US keyboard using a US mapping:
| ~event型 | `key$m | 修飾 | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Shift$kY | `shiftKey$m | |
| 2. | `keydown$et | `Q^kY | `shiftKey$m | `Latin Capital Letter Q^cn |
| 3. | `beforeinput$et | |||
| 4. | `input$et | |||
| 5. | `keyup$et | `Q^kY | `shiftKey$m | |
| 6. | `keyup$et | `Shift$kY |
次の例に、 上の例において, `Q^cap ~UIkeyを離す前に `Shift^cap ~UIkeyを離したとき, 代わりに生じ得る~UIkey連列を述べる。 ~UIkey `Q^cap 用の`~UIkey値$は、 `keyup$et ~eventに対しては,その無shift値に復帰することになる: ◎ Th example describes an alternate sequence of keys to the example above, where the Shift key is released before the Q key. The key value for the Q key will revert to its unshifted value for the keyup event:
| ~event型 | `key$m | 修飾 | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Shift$kY | `shiftKey$m | |
| 2. | `keydown$et | `Q^kY | `shiftKey$m | `Latin Capital Letter Q^cn |
| 3. | `beforeinput$et | |||
| 4. | `input$et | |||
| 5. | `keyup$et | `Shift$kY | ||
| 6. | `keyup$et | `q^kY | `Latin Small Letter Q^cn |
次の例に、 ~Unicode文字を生成しないときにアリな~UIkeyの連列を述べる (前の例と同じ環境設定の下で): ◎ The following example describes a possible sequence of keys that does not generate a Unicode character (using the same configuration as the previous example):
| ~event型 | `key$m | 修飾 | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Control$kY | `ctrlKey$m | |
| 2. | `keydown$et | `v^kY | `ctrlKey$m | `Latin Small Letter V^cn |
| `beforeinput$et/`input$et ~eventは生成されない。 ◎ No beforeinput or input events are generated. | ||||
| 3. | `keyup$et | `v^kY | `ctrlKey$m | `Latin Small Letter V^cn |
| 4. | `keyup$et | `Control$kY | ||
次の例に, `Shift^cap, `Control^cap が両者とも押されたときの~event連列を示す: ◎ The following example shows the sequence of events when both Shift and Control are pressed:
| ~event型 | `key$m | 修飾 | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Control$kY | `ctrlKey$m | |
| 2. | `keydown$et | `Shift$kY | `ctrlKey$m, `shiftKey$m | |
| 3. | `keydown$et | `V^kY | `ctrlKey$m, `shiftKey$m | `Latin Capital Letter V^cn |
| 【!複製】 `beforeinput$et/`input$et ~eventは生成されない。 ◎ No beforeinput or input events are generated. | ||||
| 4. | `keyup$et | `V^kY | `ctrlKey$m, `shiftKey$m | `Latin Capital Letter V^cn |
| 5. | `keyup$et | `Shift$kY | `ctrlKey$m | |
| 6. | `keyup$et | `Control$kY | ||
非~US~keyboard~layoutに対しても,~event連列は同じになるが、 ~UIkeyの値は,現在の~keyboard~layoutに基づく。 次の例に,~Arabic~keyboard~layoutが利用されるときの~event連列を示す: ◎ For non-US keyboard layouts, the sequence of events is the same, but the value of the key is based on the current keyboard layout. This example shows a sequence of events when an Arabic keyboard layout is used:
| ~event型 | `key$m | 修飾 | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Control$kY | `ctrlKey$m | |
| 2. | `keydown$et | `ر^kY | `ctrlKey$m | `Arabic Letter Reh^cn |
| 【!複製】 `beforeinput$et/`input$et ~eventは生成されない。 ◎ No beforeinput or input events are generated. | ||||
| 3. | `keyup$et | `ر^kY | `ctrlKey$m | `Arabic Letter Reh^cn |
| 4. | `keyup$et | `Control$kY | ||
注記: [ `keydown$et / `keyup$et ]~eventにおける値は、 ~UIkeyが押されたときに有効な現在の~keyboard~layoutに基づいて,様々になる。 これは、 同じ物理的~UIkeyであっても、 ~US~layout上の `v^cap ~UIkey と ~Arabic~layout上の `ر^cap ~UIkeyとでは, 異なる~eventを生成することを意味する。 これらの~eventを同じ物理的~UIkeyとして識別するためには、 `code$m 属性を利用する必要がある。 ◎ The value in the keydown and keyup events varies based on the current keyboard layout in effect when the key is pressed. This means that the v key on a US layout and the ر key on an Arabic layout will generate different events even though they are the same physical key. To identify these events as coming from the same physical key, you will need to make use of the code attribute.
修飾~UIkeyが,~UIkey~event用の`~UIkey値$を変化させる事例もある。 例えば,一部の MacOS ~keyboard上の “delete” ~UIkeyは、 未修飾~時にはWindows ~OS上の `Backspace^cap ~UIkeyと同じに機能するが、 `Fn^cap ~UIkeyで修飾されたときは `Delete^cap ~UIkeyとして動作し, ~UIkey値は 現在の修飾された状態に最も適切な~UIkeyの機能に合致することになる。 ◎ In some cases, modifier keys change the key value for a key event. For example, on some MacOS keyboards, the key labeled "delete" functions the same as the Backspace key on the Windows OS when unmodified, but when modified by the Fn key, acts as the Delete key, and the value of key will match the most appropriate function of the key in its current modified state.
4.3.2. ~dead-key
~keyboard入力では、 `~dead-key$を利用して組成-済み文字~連列を入力することもある。 手書き式に最初に基底~文字を手入力するのでなく、 そこでの~keyboard入力には,特別な状態に入ることが要求され、 `~dead-key$が押された~~直後では,限られた数の “合法な” 基底~文字が手入力されたときに限り,文字(たち)を発する。 ◎ Some keyboard input uses dead keys for the input of composed character sequences. Unlike the handwriting sequence, in which users enter the base character first, keyboard input requires to enter a special state when a dead key is pressed and emit the character(s) only when one of a limited number of "legal" base character is entered.
注記: [ MacOS / Linux ~OS ]は、 `~dead-key$を処理するときに~IMEを利用する。 ◎ The MacOS and Linux operating systems use input methods to process dead keys.
`~dead-key$は、 (すべての~keyboard~layout, `~UIkey対応付け$に渡り,) `~UIkey値$ `Dead$kY で表現される。 ~dead-keyが押されたときは、 ~UAは それに呼応して,`組成~event$たちを発火するモノトスル。 加えて、 その `compositionupdate$et ~eventの `CompositionEvent.data$m 値は,~dead-key結合~連列の現在の状態の`文字~値$になるモノトスル。 ◎ The dead keys (across all keyboard layouts and mappings) are represented by the key value Dead. In response to any dead key press, composition events must be dispatched by the user agent and the compositionupdate event’s data value must be the character value of the current state of the dead key combining sequence.
~Unicode結合~文字は,常に[ 対応する普通字とそれに続く結合~文字による手書き連列 ]に倣う一方で、 代表的な~dead-key入力では,その結合~文字が対応する普通字の前に来るように連列を逆順にすることもある。 例えば,単語 "naïve" は、 結合~発音区別符 "¨" を利用して,~Unicodeでは "nai¨ve" として連列的に表現されるが、 "na¨ive" と打込まれ得る。 ~keystroke連列[ `0302^U ( `Combining Circumflex Accent^cn ~UIkey), `0065^U ( `Latin Small Letter E^cn と印字される~UIkey) ]は,[ `NFC^em ( `Unicode Normalization Form^en )に選好される ~Unicode文字 `ê^kGl ( `Latin Small Letter E With Circumflex^cn ) ]を生産するであろう (~French~keyboardでは、 修飾~UIkeyを作動化させずに,~French用の`~UIkey対応付け$を利用して)。 ◎ While Unicode combining characters always follow the handwriting sequence, with the combining character trailing the corresponding letter, typical dead key input MAY reverse the sequence, with the combining character before the corresponding letter. For example, the word naïve, using the combining diacritic ¨, would be represented sequentially in Unicode as nai¨ve, but MAY be typed na¨ive. The sequence of keystrokes U+0302 (Combining Circumflex Accent key) and U+0065 (key marked with the Latin Small Letter E) will likely produce (on a French keyboard using a french mapping and without any modifier activated) the Unicode character "ê" (Latin Small Letter E With Circumflex), as preferred by the Unicode Normalization Form NFC.
| ~event型 | `key$m | `isComposing$m | `CompositionEvent.data$m | 備考 | |
|---|---|---|---|---|---|
| 1. | `keydown$et | `Dead$kY | ~F | `Combining Circumflex Accent^cn (~dead-key) | |
| 2. | `compositionstart$et | `^kGl | |||
| 3. | `compositionupdate$et | `0302^U | |||
| 4. | `keyup$et | `Dead$kY | ~T | ||
| 5. | `keydown$et | `ê^kY | ~T | ||
| 6. | `compositionupdate$et | `ê^kGl | |||
| 7. | `compositionend$et | `ê^kGl | |||
| 8. | `keyup$et | `e^kY | ~F | `Latin Small Letter E^cn |
注記: 2 個目の `keydown^c ~event(段 5)では、 (~eventは抑止されていないとするとき,) 通常の状況下では`~UIkey値$ `e^kY ( `Latin Small Letter E^cn ~UIkey)`にはならない^em — ~UAに送達される値は、 すでに~dead-key操作oにより修飾されることになるので。 ◎ In the second keydown event (step 5), the key value (assuming the event is not suppressed) will not be "e" (Latin Small Letter E key) under normal circumstances because the value delivered to the user agent will already be modified by the dead key operation.
この処理nは、 利用者が[ `~dead-key$を押した後に, ~supportされない基底~文字 (すなわち,作動中な発音区別符号が可用でない基底~文字) を打込んだとき ]には,中止され得る: ◎ This process might be aborted when a user types an unsupported base character (that is, a base character for which the active diacritical mark is not available) after pressing a dead key:
| ~event型 | `key$m | `isComposing$m | `CompositionEvent.data$m | 備考 | |
|---|---|---|---|---|---|
| 1. | `keydown$et | `Dead$kY | ~F | `Combining Circumflex Accent^cn (~dead-key) | |
| 2. | `compositionstart$et | `^kGl | |||
| 3. | `compositionupdate$et | `0302^U | |||
| 4. | `keyup$et | `Dead$kY | ~T | ||
| 5. | `keydown$et | `q^kY | ~T | `Latin Small Letter Q^cn | |
| 6. | `compositionupdate$et | `^kGl | |||
| 7. | `compositionend$et | `^kGl | |||
| 8. | `keyup$et | `q^kY | ~F |
4.3.3. ~IME( `Input Method Editors^en )
この仕様は、 `CompositionEvent$I ~interface&~event を通して,`~IME$( `Input Method Editor^en )用の~modelを含めている。 しかしながら、 `組成~event$と`~keyboard~event$を一対一に対応付けるとは限らない。 例として、 `~UIkey値$ `Accept^cap を伴う `keydown$et を受取ったとしても,それは、 `~IME$において現在~選択された~textが受容されたことを含意するとは限らず,~keystrokeが起きたことのみを指示する — 受容されている`~IME$の機能性からは切離されて (それは、 ほとんどの`~IME$~systemにおいては, 通常は `compositionend$et ~eventを生じさせることになるが)。 ~keyboard~eventは、 ~IMEの現在の状態を決定する用途には,利用できない — その状態は `CompositionEvent.data$m 属性を通して得することができる。 加えて、 `~IME$~systemや装置の機能性は様々であり、 その機能性を作動化するために,どの~UIkey — `Convert^cap / `Accept^cap ~UIkeyなど — が利用されているかは、 他の可用な~UIkeyにより表現されることもある。 ~keyboard~eventは、 ~keyboard~layout用の`~UIkey対応付け$の後に,入力~装置により生成された~eventに対応する。 ◎ This specification includes a model for input method editors (IMEs), through the CompositionEvent interface and events. However, Composition Events and Keyboard Events do not necessarily map as a one-to-one relationship. As an example, receiving a keydown for the Accept key value does not necessarily imply that the text currently selected in the IME is being accepted, but indicates only that a keystroke happened, disconnected from the IME Accept functionality (which would normally result in a compositionend event in most IME systems). Keyboard events cannot be used to determine the current state of the input method editor, which can be obtained through the data attribute of the CompositionEvent interface. Additionally, IME systems and devices vary in their functionality, and in which keys are used for activating that functionality, such that the Convert and Accept keys MAY be represented by other available keys. Keyboard events correspond to the events generated by the input device after the keyboard layout mapping.
注記: 一部の実装/~system環境設定においては、 一部の~UIkey~eventやその値は,利用-中にある`~IME$により抑止されることがある。 ◎ In some implementations or system configurations, some key events, or their values, might be suppressed by the IME in use.
次の例に、 日本語~IMEを利用して, ~Unicode文字 `~~市^kGl ( `CJK Unified Ideographs^en の一部である漢字 ) が生成されるときにアリな~UIkey連列を述べる。 この例では、 ~IMEは作動化されていて,日本語~Romaji入力~mode下にあるとする。 ~UIkey `Convert^cap ( “~~変換” )/ `Accept^cap ( “~~確定” ) は、 利用-中にある入力~装置や~IMEの環境設定に依存して,他に置換されることもある — 例えば `~SPACEBAR^cap ( `0020^U )/ `Enter^cap にもなり得る。 ◎ The following example describes a possible sequence of keys to generate the Unicode character "市" (Kanji character, part of CJK Unified Ideographs) using Japanese input methods. This example assumes that the input method editor is activated and in the Japanese-Romaji input mode. The keys Convert and Accept MAY be replaced by others depending on the input device in use and the configuration of the IME, e.g., it can be respectively U+0020 (Space key) and Enter.
注記: `~~詩^kGl と `~~市^kGl は異形同音異義語であり, いずれも “し” と発音されるので、 利用者は, `Convert^cap ~UIkeyを利用して 適正な~optionを選択する必要がある。 ◎ "詩" ("poem") and "市" ("city") are homophones, both pronounced し ("shi"/"si"), so the user needs to use the Convert key to select the proper option.
| ~event型 | `key$m | `isComposing$m | `CompositionEvent.data$m | 備考 | |
|---|---|---|---|---|---|
| 1. | `keydown$et | `s^kY | ~F | `Latin Small Letter S^cn | |
| 2. | `compositionstart$et | `^kGl | |||
| 3. | `beforeinput$et | ||||
| 4. | `compositionupdate$et | `s^kGl | |||
| ~DOMは更新された ◎ DOM is updated | |||||
| 5. | `input$et | ||||
| 6. | `keyup$et | `s^kY | ~T | ||
| 7. | `keydown$et | `i^kY | ~T | `Latin Small Letter I^cn | |
| 8. | `beforeinput$et | ||||
| 9. | `compositionupdate$et | `し^kGl | ◎ shi | ||
| ~DOMは更新された ◎ DOM is updated | |||||
| 10. | `input$et | ||||
| 11. | `keyup$et | `i^kY | ~T | ||
| 12. | `keydown$et | `Convert$kY | ~T | “~~変換” ◎ Convert | |
| 13. | `beforeinput$et | ||||
| 14. | `compositionupdate$et | `詩^kGl | ◎ "poem" | ||
| ~DOMは更新された ◎ DOM is updated | |||||
| 15. | `input$et | ||||
| 16. | `keyup$et | `Convert$kY | ~T | ||
| 17. | `keydown$et | `Convert$kY | ~T | “~~変換” ◎ Convert | |
| 18. | `beforeinput$et | ||||
| 19. | `compositionupdate$et | `市^kGl | ◎ "city" | ||
| ~DOMは更新された ◎ DOM is updated | |||||
| 20. | `input$et | ||||
| 21. | `keyup$et | `Convert$kY | ~T | ||
| 22. | `keydown$et | `Accept$kY | ~T | “~~確定” ◎ Accept | |
| 23. | `compositionend$et | `市^kGl | |||
| 24. | `keyup$et | `Accept$kY | ~F |
~IME組成は、 前掲の例と一致する条件で,次の例のとおり取消され得る。 ~UIkey `Cancel^cap も利用-中にある入力~装置や~IMEの環境設定に依存して,他に置換され得る — 例えば `001B^U ( `Escape^cap ~UIkey )にもなり得る。 ◎ IME composition can also be canceled as in the following example, with conditions identical to the previous example. The key 'Cancel' might also be replaced by others depending on the input device in use and the configuration of the IME, e.g., it could be U+001B (Escape key).
| ~event型 | `key$m | `isComposing$m | `CompositionEvent.data$m | 備考 | |
|---|---|---|---|---|---|
| 1. | `keydown$et | `s^kY | ~F | `Latin Small Letter S^cn | |
| 2. | `compositionstart$et | `^kGl | |||
| 3. | `compositionupdate$et | `s^kGl | |||
| 4. | `keyup$et | `s^kY | ~T | ||
| 5. | `keydown$et | `i^kY | ~T | `Latin Small Letter I^cn | |
| 6. | `compositionupdate$et | `し^kGl | |||
| 7. | `keyup$et | `i^kY | ~T | ||
| 8. | `keydown$et | `Convert$kY | ~T | “~~変換” ◎ Convert | |
| 9. | `compositionupdate$et | `詩^kGl | |||
| 10. | `keyup$et | `Convert$kY | ~T | ||
| 11. | `keydown$et | `Convert$kY | ~T | “~~変換” ◎ Convert | |
| 12. | `compositionupdate$et | `市^kGl | |||
| 13. | `keyup$et | `Convert$kY | ~T | ||
| 14. | `keydown$et | `Cancel$kY | ~T | “~~取消” ◎ Cancel | |
| 15. | `compositionupdate$et | `^kGl | |||
| 16. | `compositionend$et | `^kGl | |||
| 17. | `keyup$et | `Cancel$kY | ~F |
注記: `~IME$( MacOS ~OS上など)によっては、 組成を取消す前に組成~data属性に`空~文字列$を設定するものもある。 ◎ Some input method editors (such as on the MacOS operating system) might set an empty string to the composition data attribute before canceling a composition.
4.3.3.1. ~IME~mode~UIkey
ある種の装置では、 一部の~UIkeyに,[ `~IME$を作動化したり, 作動中な`~IME$の~modeを変更する ]ような機能性が意図されている。 これを目的とする~UIkeyは、 装置や言語~modeごとに異なるものが定義され得る。 この仕様では、 次に挙げるものが,これを目的とする~UIkeyとして定義される ⇒# `Alphanumeric$kY, `CodeInput$kY, `FinalMode$kY, `HangulMode$kY, `HanjaMode$kY, `Hiragana$kY, `JunjaMode$kY, `KanaMode$kY, `KanjiMode$kY, `Katakana$kY, `Romaji$kY ◎ Some keys on certain devices are intended to activate input method editor functionality, or to change the mode of an active input method editor. Custom keys for this purpose can be defined for different devices or language modes. The keys defined in this specification for this purpose are: "Alphanumeric", "CodeInput", "FinalMode", "HangulMode", "HanjaMode", "Hiragana", "JunjaMode", "KanaMode", "KanjiMode", "Katakana", and "Romaji".\
`~IME$が作動中でない下で,これらいずれかの~UIkeyが押されたときは、 (可用なら)適切な`~IME$が,~UIkeyにより指示される~modeで作動化されるものと期待される。 ~UIkeyが押されたとき,`~IME$がすでに作動中である場合、[ 装置/~app ]に特有なふるまいに基づいて,`~IME$が 指示された~modeへ変更されたり, 異なる`~IME$が立上げられたり, あるいは無視されることもある。 ◎ When one of these keys is pressed, and no IME is currently active, the appropriate IME is expected to be activated in the mode indicated by the key (if available). If an IME is already active when the key is pressed, the active IME might change to the indicated mode, or a different IME might be launched, or the might MAY be ignored, on a device- and application-specific basis.
この仕様は、 他の~UIkey — 特定的には、 次に挙げる`~IME$に意図される操作o用の~UIkey — も定義する ⇒# `Accept$kY, `AllCandidates$kY, `Cancel$kY, `Convert$kY, `Compose$kY, `Zenkaku$kY ( `FullWidth^en ), `Hankaku$kY ( `HalfWidth^en ), `NextCandidate$kY, `NonConvert$kY, `PreviousCandidate$kY ◎ This specification also defines other keys which are intended for operation specifically with input method editors: "Accept", "AllCandidates", "Cancel", "Convert", "Compose", "Zenkaku" (FullWidth), "Hankaku" (HalfWidth), "NextCandidate", "NonConvert", and "PreviousCandidate".\
これらの~UIkeyの機能は、 この仕様では定義されない — `~IME$機能性についての詳細は、 他の資料を見よ。 ◎ The functions of these keys are not defined in this specification — refer to other resources for details on input method editor functionality.
注記: `~IME$機能を伴う~UIkeyは、 その目的に制約されず,他の装置や実装に特有な目的があることもある。 ◎ Keys with input method editor functions are not restricted to that purpose, and can have other device- or implementation-specific purposes.
4.3.4. 既定~動作と取消~可能~keyboard~event
`keydown$et ~eventの`既定~動作$が取消されたときは, それと対を成す `keyup$et ~eventには影響しないモノトスルが、 それに対応する[ `beforeinput$et / `input$et /(~support有りなら) `keypress$et ]~eventは生成しないようにするモノトスル。 次の例に、 ~US~keyboardで, ~US用の`~UIkey対応付け$を利用している下で, ~Unicode文字 Q( `Latin Capital Letter Q^cn ) が生成されるときにアリな~UIkey連列を述べる: ◎ Canceling the default action of a keydown event MUST NOT affect its respective keyup event, but it MUST prevent the respective beforeinput and input (and keypress if supported) events from being generated. The following example describes a possible sequence of keys to generate the Unicode character Q (Latin Capital Letter Q) on a US keyboard using a US mapping:
| ~event型 | `key$m | `InputEvent.data$m | 修飾 | 備考 | |
|---|---|---|---|---|---|
| 1. | `keydown$et | `Shift$kY | `shiftKey$m | ||
| 2. | `keydown$et | `Q^kY | `shiftKey$m | 【!複製】 `既定~動作$は、 例えば `preventDefault()$m の呼出ngにより,防止された。 ◎ The default action is prevented, e.g., by invoking preventDefault(). | |
| [ `beforeinput$et/`input$et ]~event, および(~supportされるなら)`keypress$et ~eventは、 生成されない ◎ No beforeinput or input (or keypress, if supported) events are generated | |||||
| 3. | `keyup$et | `Q^kY | `shiftKey$m | ||
| 4. | `keyup$et | `Shift$kY |
~UIkeyが修飾~UIkeyであった場合、 ~keystrokeは,依然として修飾~状態に織り込むモノトスル。 次の例に、 ~US~keyboardで, ~US用の`~UIkey対応付け$を利用している下で, ~Unicode文字 Q( `Latin Capital Letter Q^cn ) が生成されるときにアリな連列を述べる: ◎ If the key is a modifier key, the keystroke MUST still be taken into account for the modifiers states. The following example describes a possible sequence of keys to generate the Unicode character Q (Latin Capital Letter Q) on a US keyboard using a US mapping:
| ~event型 | `key$m | `InputEvent.data$m | 修飾 | 備考 | |
|---|---|---|---|---|---|
| 1. | `keydown$et | `Shift$kY | `shiftKey$m | 【!複製】 `既定~動作$は、 例えば `preventDefault()$m の呼出ngにより,防止された。 ◎ The default action is prevented, e.g., by invoking preventDefault(). | |
| 2. | `keydown$et | `Q^kY | `shiftKey$m | ||
| 3. | `beforeinput$et | `Q^kGl | |||
| 4. | `input$et | ||||
| 5. | `keyup$et | `Q^kY | `shiftKey$m | ||
| 6. | `keyup$et | `Shift$kY |
~UIkeyが何回かの~keystrokeからなる連列の一部を成す場合, それが`~dead-key$であれ, ~IME連列に寄与しているものであれ、 その~keystrokeは, `keydown$et ~event上で`既定~動作$が取消された場合に限り,無視するモノトスル (織り込まれない)。 `~dead-key$による`keyup$et ~eventを取消しても, `beforeinput$et / `input$et ~eventには効果がない。 次の例に、 ~French~keyboardで, ~French用の`~UIkey対応付け$を利用し,どの修飾も作動化されない下で、[ ~dead-key `Dead$kY ( `0302^U `Combining Circumflex Accent^cn ~UIkey) ], [ `e^kY ~UIkey( `0065^U `Latin Small Letter E^cn ~UIkey) ]を利用したときに生じる~event連列を示す: ◎ If the key is part of a sequence of several keystrokes, whether it is a dead key or it is contributing to an Input Method Editor sequence, the keystroke MUST be ignored (not taken into account) only if the default action is canceled on the keydown event. Canceling a dead key on a keyup event has no effect on beforeinput or input events. The following example uses the dead key "Dead" (U+0302 Combining Circumflex Accent key) and "e" (U+0065, Latin Small Letter E key) on a French keyboard using a French mapping and without any modifier activated:
| ~event型 | `key$m | `InputEvent.data$m | 備考 | |
|---|---|---|---|---|
| 1. | `keydown$et | `Dead$kY | 【!複製】 `既定~動作$は、 例えば `preventDefault()$m の呼出ngにより,防止された。 ◎ The default action is prevented, e.g., by invoking preventDefault(). | |
| 2. | `keyup$et | `Dead$kY | ||
| 3. | `keydown$et | `e^kY | ||
| 4. | `beforeinput$et | `e^kGl | ||
| 5. | `input$et | |||
| 6. | `keyup$et | `e^kY |
5. 外部~algo
この節は、 この仕様により要求されるが,他の仕様が~hostする方が適正になる~algoを包含する。 ◎ This sections contains algorithms that are required by this specification, but are more properly hosted by other specifications.
注記: この節は、 これらの定義~用の一時的な~~場所として~serveすることが意図される。 それらは、 最終的には,もっと適切な~~場所へ移動されるべきであり、 そのときには,この節~全体が削除され得る。 ◎ The intent is that this sections serve as a temporary home for these definitions, and they should eventually be moved into a more appropriate home so this entire section can be deleted.
5.1. 中核~DOM~algo
注記: 以下に与える~algoは、 どこか【他の仕様】へ移動されるべきである。 ◎ The following algorithms should be moved... somewhere.
5.2. ~pointer~lock用の~algo
注記: 以下に与える~algoは、 `PointerLock$r の中へ移動されるべきである。 ◎ The following algorithm should be moved into the [PointerLock] spec.
【 “~pointer~lock” は, 原文では `PointerLock^en と称されるが、 これは,~interfaceの名前ではなく仕様の名前である。 】
5.2.1. ~pointer~lock用の大域的な状態
~UAは、 各`~window$の中で共有される値をとして,次を保守するモノトスル ⇒ `最後の~mousemove位置@ ⇒ 最後の `mousemove$et ~eventの位置を記録する — 初期~時は ε とする。 ◎ 5.2.1.1. Window-Level State ◎ The UA must maintain the following values that are shared for the Window. ◎ A last mouse move value (initially undefined) that records the position of the last mousemove event.
5.2.2. 各種~algo
`~MouseEvent用に各~pointer~lock属性を初期化する@ ~algoは、 所与の ( `MouseEvent$I %~event ) に対し: ◎ 5.2.2. initialize PointerLock attributes for MouseEvent ◎ Input • event, a MouseEvent Output • None
- %~event の ⇒# `movementX$m ~SET 0, `movementY$m ~SET 0 ◎ Set event.movementX = 0 ◎ Set event.movementY = 0
`~mousemove用に各~pointer~lock属性を設定する@ ~algoは、 所与の ( `MouseEvent$I %~event ) に対し: ◎ 5.2.3. set PointerLock attributes for mousemove ◎ Input • event, a MouseEvent Output • None
- ~IF[ %~event の `type$m ~NEQ `mousemove^l ] ⇒ ~RET ◎ If event.type is not "mousemove", then exit
- ( %~x, %~y ) ~LET ( %~event の `screenX@~POINTEREVENTS#dom-mouseevent-screenx$m, %~event の `screenY@~POINTEREVENTS#dom-mouseevent-screeny$m ) ◎ ↓
- ( %動き~x, %動き~y ) ~LET ( 0, 0 ) ◎ If last mouse move is not defined, then • Set event.movementX = 0 • Set event.movementY = 0
- ~IF[ `最後の~mousemove位置$ ~NEQ ε ] ⇒# %動き~x ~SET %~x ~MINUS `最後の~mousemove位置$の~x座標; %動き~y ~SET %~y ~MINUS `最後の~mousemove位置$の~y座標 ◎ Otherwise, • Set event.movementX = event.screenX - last mouse move’s x-coordinate • Set event.movementY = event.screenX - last mouse move’s y-coordinate
- %~event の ⇒# `movementX$m ~SET %動き~x, `movementY$m ~SET %動き~y ◎ ↑
- `最後の~mousemove位置$ ~SET ( %~x, %~y ) ◎ Set last mouse move = ( event.screenX, event.screenY )
6. 旧来の~event初期化子
`legacy-event-initializers^APX7. 旧来の~UIkey属性
`legacy-key-attributes^APX8. 旧来の~event型
`legacy-event-types^APX9. ~eventの拡張-法
`extending-events^APX10. ~securityの考慮点
`security-considerations^APX11. 変更点
`changes-from-earlier-versions^APX12. 謝辞
`acknowledgements-contributors^APX13. 用語集
次の用語の定義の一部は、 他の[ W3C /標準 ]文書の類似な定義から借用されたり, 改変されている。 詳細は、 定義~内の~linkを見よ。 ◎ Some of the following term definitions have been borrowed or modified from similar definitions in other W3C or standards documents. See the links within the definitions for more information.
【 適合性に関連な用語は、 `別~pageの § 用語集@~UIEVENTS-A#glossary$ に挙げる。 】【 ここでは、 原文の~~アルファベット順による並びに代えて, 互いの関連度に基づく並びに改めている。 】
- `要素@ ( `element^en )
- `Element$I ~interface `DOM$r を~instance化した~obj
- `根~要素@ ( `root element^en )
- `文書~要素$。 [ ~HTML/ ~XHTML ]`文書$においては、 `html^e 要素が該当する。 ◎ The first element node of a document, of which all other elements are children. The document element.
- `~body要素@ ( `body element^en )
- [ ~HTML/ ~XHTML ]`文書$においては、 `根~要素$の子孫【子?】である `body^e 要素のうち,最初のもの。 ~body要素は,文書の内容を表現する。 【`~HTML仕様による定義@~HTMLdom#the-body-element-2$】 ◎ In HTML or XHTML documents, the body element represents the contents of the document. In a well-formed HTML document, the body element is a first descendant of the root element.
- `空~文字列@ ( `empty string^en )
- 長さ 0 の,`DOMString^I 型~値。 ◎ The empty string is a value of type DOMString of length 0, i.e., a string which contains no characters (neither printing nor control characters).
- `未初期化~値@ ( `un-initialized value^en )
- ~eventが `initEvent()$m† で初期化される前の,各種~event属性 ( `bubbles$m や `currentTarget$m など) が,既定でとるものとされる値。 ~eventの未初期化~値は、 `Document.createEvent()$m ~method††を利用して 新たな~eventが作成される時点で適用される。 ◎ The value of any event attribute (such as bubbles or currentTarget) before the event has been initialized with initEvent(). The un-initialized values of an event apply immediately after a new event has been created using the method createEvent().
- 【† または,構築子に与える `EventInit$I (または それを継承する)型の辞書~引数 】【†† または,各種~event~interfaceの構築子 】【 この種の値は、 “既定値( `default value^en )” 命名されることが多いが、 この名前にされている理由は,~IDL用語の “既定値” と区別するためと思われる。 】
- `~event型@ ( `event type^en )
- `~event$~objの~event型は、 特定0の名前を伴い, 特定0の[ 誘発~条件, ~prop, 他の~event型から判別される他の特性 ]を定義する。 例えば、 ~event型 `keydown$et の特性は `blur$et や `load$et とは異なる。 ~event型は、 ~event~obj上では `type$m 属性として公開される。 ~event型が `keydown$et である~eventは、 “`keydown^et ~event” のように略記されることもある。 ◎ An event type is an event object with a particular name and which defines particular trigger conditions, properties, and other characteristics which distinguish it from other event types. For example, the keydown event type has different characteristics than the blur or load event types. The event type is exposed as the type attribute on the event object. Also loosely referred to as "event", such as the keydown event.
- `~event~focus@ ( `event focus^en )
- ~event~focusは、 `文書$の中の[ 特定0の要素~その他の`~event~target$ ]において,[ ~~目立たせている/~~注視されている ]ような特別な状態である。 ~focusされたときの挙動は、 各~要素ごとに その機能性に依存して異なる — [ (~buttonや~hyperlink用に)要素を作動化~対象の首位に据える/ (~checkbox用に)状態を~toggleする/ (~text~form~field用に)~text入力を受取る/ 選択された~textを複製する ]など。 詳細は `§ 文書~focusと~focus文脈@#events-focusevent-doc-focus$を見よ。 ◎ Event focus is a special state of receptivity and concentration on an particular element or other event target within a document. Each element has different behavior when focused, depending on its functionality, such as priming the element for activation (as for a button or hyperlink) or toggling state (as for a checkbox), receiving text input (as for a text form field), or copying selected text. For more details, see § 4.3.3 Document Focus and Focus Context.
- `~event~focus環@ ( `event focus ring^en )
- ~event~focus環とは、 `文書$内の`~event~focus$の~targetになり得るものからなる有順序~集合である。 `~host言語$は、 これらの~targetの順序を決定する複数の仕方を定義することもある — [ 文書~順序 / 各~focus~targetに定義される数量的~index / 各~focus~targetに明示的に与えられる次の~target / これらの異なる~modelの~~混成 ]など。 文書は、 複数の~focus環や条件付き~focus環を包含することもある。 概して、[ 文書~順序/~index【~tab~index】 ]に基づく~focus環においては、 最後の~focus~targetの次の~focusは, “最初へ戻る” 。 ◎ An event focus ring is an ordered set of event focus targets within a document. A host language MAY define one or more ways to determine the order of targets, such as document order, a numerical index defined per focus target, explicit pointers between focus targets, or a hybrid of different models. Each document MAY contain multiple focus rings, or conditional focus rings. Typically, for document-order or indexed focus rings, focus wraps around from the last focus target to the first.
- `~event~target@ ( `event target^en, 略して “~target” )
- ~event~flowを利用して,`~event$の`~target@~DOM4#event-target$にされている~obj — `target$m 属性の値が,それを与える。 ◎ The object to which an event is targeted using the event flow. The event target is the value of the target attribute.
- `作動化の誘発@ ( `activation trigger^en )
- `作動化の挙動$を起動するように定義された~event。 ◎ An event which is defined to initiate an activation behavior.
- `既定~動作@ ( `default action^en )
- `既定~動作$は、 任意選択†な補足的な挙動であって,実装が~event~objの配送-と組合せて遂行しなければナラナイものである。 各種~event型~定義, および 各種 仕様は、 その~event型~用の`既定~動作$があれば,それを定義する。 `作動化の誘発$に結付けられたときなど、 一部の状況下では,~eventの各~instanceには`既定~動作$が複数ある場合もある。 `既定~動作$は、 `preventDefault()$m ~methodの呼出nを通して取消されることもある。 ◎ A default action is an OPTIONAL supplementary behavior that an implementation MUST perform in combination with the dispatch of the event object. Each event type definition, and each specification, defines the default action for that event type, if it has one. An instance of an event MAY have more than one default action under some circumstances, such as when associated with an activation trigger. A default action MAY be cancelled through the invocation of the preventDefault() method.
- 【† どの主体から見て任意選択なのかはっきりしない — 実装ではなく,この仕様を参照している他の仕様? 】
- `文字~値@ ( `character value^en )
- ~UIkey値の文脈においては、 文字~値は, 1 個~以上の~Unicode文字を表現する文字列である — 普通字や記号, あるいは 何個かの普通字が成す並びなど,それぞれが妥当な`~Unicode字種$が成す集合に属するような。 この仕様では、 文字~値は ~Unicode文字列(例: `0020^U ), または 同じ符号位置の~glyph表現(例: `X^kGl )として記され、 2 つの表現を判別し易くするよう色付けられる。 ◎ In the context of key values, a character value is a string representing one or more Unicode characters, such as a letter or symbol, or a set of letters, each belonging to the set of valid Unicode character categories. In this specification, character values are denoted as a unicode string (e.g., U+0020) or a glyph representation of the same code point (e.g., " "), and are color coded to help distinguish these two representations.
- 注記: ~source~codeにおいては、 非~graphic文字などの一部の~UIkey値は, 利用-中にある~programming言語の文字~escape構文を利用して表現され得る。 ◎ In source code, some key values, such as non-graphic characters, can be represented using the character escape syntax of the programming language in use.
- `~UIkey値@ ( `key value^en )
- ~UIkey値は、 特定0の状態にある~UIkeyに結付けられた,`文字~値$ または[ 複数~文字からなる文字列 ( `Enter$kY, `Tab$kY, `MediaTrackNext$kY など) ]である。 ~UIkey値は、 どの~UIkeyにも — 制御~UIkey, ~function~UIkey, `修飾~UIkey$, `~dead-key$, その他の~UIkeyも含む — `文字~値$を有するかどうかに関わらず,あてがわれる。 与えられた時点の与えられたどの~UIkeyの~UIkey値も、 `~UIkey対応付け$に依存する。 ◎ A key value is a character value or multi-character string (such as "Enter", "Tab", or "MediaTrackNext") associated with a key in a particular state. Every key has a key value, whether or not it has a character value. This includes control keys, function keys, modifier keys, dead keys, and any other key. The key value of any given key at any given time depends upon the key mapping.
- `修飾~UIkey@ ( `modifier key^en )
- 修飾~UIkeyは、 ~UIkeyの通常の挙動を変更する — ( `Shift^cap ~UIkeyで)異なる文字caseを生産させたり, (`Fn^cap や `Alt^cap ~UIkeyなどで)~UIkeyが誘発する機能性を改めるなど。 修飾~UIkeyについての情報は、 `§ 修飾~UIkey@#keys-modifiers$を見よ。 妥当な修飾~UIkeyたちが成す~listは、 `UIEvents-Key$r の`修飾~UIkeyの表t$内にある。 ◎ A modifier key changes the normal behavior of a key, such as to produce a character of a different case (as with the Shift key), or to alter what functionality the key triggers (as with the Fn or Alt keys). See § 5.3.1 Modifier keys for more information about modifier keys and refer to the Modifier Keys table in [UIEvents-Key] for a list of valid modifier keys.
- `~dead-key@ ( `dead key^en )
- ~dead-keyは、 自身は文字を生産しないが,[ 別の~UIkeyとの[ 組合n/連列 ]により,修飾された文字 — 発音区別符号を伴う文字(例: `ö^kGl, `é^kGl, `â^kGl )など — を生産する ]ような[ ~UIkeyまたは~UIkeyの組合n ]である。 ◎ A dead key is a key or combination of keys which produces no character by itself, but which in combination or sequence with another key produces a modified character, such as a character with diacritical marks (e.g., "ö", "é", "â").
- `~text組成~system@ ( `text composition system^en )
- 何らかの形による代替-入力 (`~IME$, 発話~処理器, 手書き認識~systemなど) を解釈して,それを~textに変換する~software~component。 ◎ A software component that interprets some form of alternate input (such as a input method editor, a speech processor, or a handwriting recognition system) and converts it to text.
- `~UIkey対応付け@ ( `key mapping^en )
- ~UIkey対応付けは、 特定0の~UIkeyに~UIkey値をあてがう処理nであり、 いくつかの要因 — ~OSや~keyboard~layout (例: `QWERTY$, Dvorak, Spanish, InScript, Chinese, 等々), および[ `修飾~UIkey$( `Shift^cap, `Alt^cap, 等々)/ `~dead-key$ ]の状態すべてを含む — を組合せた結果である。 ◎ Key mapping is the process of assigning a key value to a particular key, and is the result of a combination of several factors, including the operating system and the keyboard layout (e.g., QWERTY, Dvorak, Spanish, InScript, Chinese, etc.), and after taking into account all modifier key (Shift, Alt, et al.) and dead key states.
- `~IME@ ( `input method editor^en, 入力方式エディタ )
- ~IMEは、 一連の~keystrokeから表意文字その他の文字への変換を — 通例的に,利用者により手引きされる辞書検索により — 遂行する~appであり、 東アジア圏の言語(例:中国語, 日本語, 韓国語)でよく利用される。 ~IMEは、 携帯~機器などでも単語の入力補完に利用されることもある。 この仕様における~IMEの扱いについては、 `§ ~IME@#keys-IME$を見よ。 § `~text組成~system$も見よ。 ◎ An input method editor (IME), also known as a front end processor, is an application that performs the conversion between keystrokes and ideographs or other characters, usually by user-guided dictionary lookup, often used in East Asian languages (e.g., Chinese, Japanese, Korean). An IME MAY also be used for dictionary-based word completion, such as on mobile devices. See § 5.3.3 Input Method Editors for treatment of IMEs in this specification. See also text composition system.
- `QWERTY@
- QWERTY( “ˈkwɜrti” と発音される)は、 共通的な~keyboard~layoutの普通字~UIkeyの上段の最初の 6 文字が Q, W, E, R, T, Y であることから命名されている。 他にも~popularな~keyboard~layoutは数多くあり(~Dvorakや~Colemak~layoutなど)、 そのほとんどは,地域化や人間工学~用に設計されている。 ◎ QWERTY (pronounced ˈkwɜrti) is a common keyboard layout, so named because the first five character keys on the top row of letter keys are Q, W, E, R, T, and Y. There are many other popular keyboard layouts (including the Dvorak and Colemak layouts), most designed for localization or ergonomics.
- `~Unicode字種@ ( `Unicode character categories^en )
-
各~Unicode符号位置に対し定義されている
`General Category^en 値の部分集合。
この部分集合には、
次に挙げる字種に属するものすべてが包含される:
- 普通字( `Letter^en ): Ll, Lm, Lo, Lt, Lu
- 数字n( `Number^en ): Nd, Nl, NO
- 約物( `Punctuation^en ): Pc, Pd, Pe, Pf, Pi, Po, Ps
- 記号( `Symbol^en ): Sc, Sk, Sm, So