IDs to add to the inner control's aria-describedby: the hint, then the shown message.
checkValidity()
True when the value is valid; otherwise fires invalid and returns false, like native.
reportValidity()
Like checkValidity(), and also shows the browser's validation message when invalid.
setCustomValidity(message)
Set (non-empty) or clear (empty string) a custom validation error, like native controls.
setValidityState(flags, message, anchor)
For subclasses: set the validity flags and message. anchor is the element the browser points its message at.
validate()
Show (or clear) the error from the control's own checks: required, type, pattern, min,
max and the like. Uses error-message, else the browser's localized message. An error the
author set (a server error, say) is left as it is.
clearValidation()
Clear the error and warning that validate() and warning-pattern showed (a form reset does).
emitValue(commit)
For subclasses: fire the value events, as a native control does on a user edit: input
(bubbles, composed), then with commit also change (bubbles, stays in its tree).
idrefText(ids)
For subclasses: the text of the elements an ID reference list names, resolved in the host's
tree (ID references cannot cross a shadow root), joined by spaces.
Events
Event
Description
input
Fired once when a commit changes the value, before change.
change
Fired once when a commit changes the value.
Slots
Slot
Description
(default)
Not used.
CSS parts
Style the inside of the component with ::part(), for example focsd-editable::part(layout).
Part
Description
layout
The box around the label and the body; `data-position` is the label position.
label
The visible label (display mode; the editor shows its own).
body
The display button and the messages.
display
The button that shows the value and starts editing.
value
The value inside the button.
placeholder
The placeholder (or "Empty") inside the button when there is no value.
icon
The edit icon.
editor
The text field or textarea shown while editing.
hint
The hint text.
message
The shown error, warning or success message (also `error`, `warning` or `success`).
message-icon
The message's icon.
announcer
The visually hidden status region.
Accessibility
Display mode is a button named "label: value, edit" (the visible label comes first, so the name starts with it). With no value it reads the placeholder, or "Empty".
Editing swaps in a text field (a textarea with multiline) named by the label. The text is selected and focused. A commit refused because the value is blank with required, or invalid, keeps the editor open and shows the error as its description.
Focus returns to the button after Enter or Escape. Moving focus to another element commits unless keep-open-on-blur is set, which keeps the draft open. Switching windows or tabs neither commits nor cancels.
Escape stops there, so a dialog around the editable stays open. Enter during IME composition picks a candidate and does not commit.
Fires one input and one change for a commit that changed the value, and nothing while typing. Escape fires focsd-cancel. Reset and restore leave edit mode without events.
Keyboard
Key
Action
Enter / Space
On the button: start editing
Enter
In a single line: commit
Ctrl/Cmd + Enter
In multiline: commit (Enter adds a new line)
Escape
Cancel and restore the previous value
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.