类型 HitOptions

API 文档由 Go 源码生成,内容为英文。

type HitOptions struct {
	Role     Role
	Cursor   PointerCursor
	Value    string
	Hint     string
	Disabled bool
	// FocusableWhenDisabled keeps a disabled control in the Tab order and
	// focusable, as Base UI's accordion, collapsible and tab triggers do; it
	// never activates. Pointer presses still skip it.
	FocusableWhenDisabled bool
	Checked               bool
	// Mixed marks a checkbox in the indeterminate state (aria-checked="mixed").
	Mixed    bool
	Selected bool
	Expanded bool
	// Expandable marks a control that opens and closes something (a disclosure,
	// an accordion trigger, a menu with a submenu), so assistive technology
	// offers expand and collapse for it whichever state it is in now. A
	// combobox is always expandable.
	Expandable bool
	Multiline  bool
	ReadOnly   bool
	// Secure marks a password field. Its Value is always dropped so no
	// accessibility, mirroring, or reload path can expose it, and the runtime
	// masks what the platform text service draws.
	Secure bool
	// Description is a longer explanation than Hint, announced after the name
	// (aria-description).
	Description string
	// Level is the heading level, 1 to 9, or the nesting depth of a tree item.
	Level uint8
	// PosInSet and SetSize place an item among its siblings, counting from 1
	// (aria-posinset and aria-setsize). Zero means not stated.
	PosInSet, SetSize int32
	// Live makes the region announce changes to its content.
	Live LiveRegion
	// Range is the numeric value of a slider or a progress bar.
	Range     ValueRange
	SkipFocus bool
	// SkipTab keeps a focusable hit out of Tab traversal while leaving it
	// reachable by arrow keys, an explicit Focus, and labels. A roving group
	// (tabs, radios, a calendar grid) gives its selected item the tab stop and
	// marks every other item SkipTab.
	SkipTab bool
	// Backdrop marks a hit that only catches clicks away from an overlay, such
	// as the window-wide dismiss area behind a dialog or a menu. It is not a
	// control: a press on it dismisses the overlay as it would anywhere else,
	// including over a move region of a custom titlebar, which still moves the
	// window once the pointer drags (see MoveRegion).
	Backdrop bool
	// PassSecondary, on a Backdrop, makes a secondary press the way a native
	// menu takes it: the press dismisses the overlay as a click on the backdrop
	// would, and once the overlay is gone it is delivered again to whatever lies
	// under the pointer. A menu thereby moves to the next control that has one
	// in a single right click. Other buttons only dismiss. A dialog leaves it
	// off: it keeps the page behind it out of reach.
	PassSecondary bool
	// PassPrimary, on a Backdrop, is PassSecondary for a non-modal popover: a
	// primary press dismisses the overlay and is then delivered again to the
	// control beneath, so the first click outside both closes the popup and does
	// what the user aimed at, as a web popover does.
	PassPrimary bool
	// label makes the hit a label of its ID's control (see Canvas.HitLabel).

	// Autofocus gives the hit the keyboard in the paint where it first
	// appears, that is, when the previous paint did not declare its ID. Use it
	// for a page that should be ready to type into as soon as it is shown,
	// such as a terminal. A hit that stays painted keeps whatever focus the
	// user gave it.
	Autofocus bool
	// TextBounds, TextSize and TextColor describe the text a text field
	// paints: where it sits, how large it is and what color. A native editor
	// that takes over the field draws exactly there, so focusing the field
	// does not move or resize its text. The runtime uses them wherever the
	// application's text input leaves its own bounds, size or color unset.
	TextBounds Rect
	TextSize   float32
	TextColor  Color
	// NavigationKeys asks Up, Down, PageUp and PageDown to reach the
	// application as raw ui.KeyEvents while the field is focused, instead
	// of being consumed by the text system or moving its caret. Use it
	// for a search field, combobox or command palette with a dropdown.
	// Cursor placement, selection, Home/End, word navigation and
	// input-method composition remain native.
	// Honored by the macOS text system and app.Driver; the other platform
	// backends do not consult it yet.
	NavigationKeys bool
	// Placement is set by a text field that lays its text out in rows itself
	// (a wrapping Textarea). The runtime then puts the caret where a press or
	// drag lands according to it, rather than the platform editor, which knows
	// one line only, and moves input-method windows to CaretBounds.
	Placement TextPlacement

}

HitOptions describes interaction and accessibility state without a dynamic property bag. Zero values represent an enabled focusable button.