Class VisualElement<T extends VisualElement<T>>

java.lang.Object
com.oorian.html.Element<T>
com.oorian.html.VisualElement<T>
Direct Known Subclasses:
StyledElement

public abstract class VisualElement<T extends VisualElement<T>> extends Element<T>
Base class for visible, interactive HTML elements.

VisualElement extends Element to provide attributes and event handlers that are meaningful on elements rendered in the viewport. These include visual/interactive global attributes (such as accesskey, draggable, and contenteditable) and client-side JavaScript event handler attributes (such as onclick and onmouseover).

Non-visual elements like <head>, <meta>, <script>, and <style> extend Element directly and do not inherit these visual capabilities.

Visual/interactive attributes:

  • accesskey — keyboard shortcut to activate or focus the element
  • autocapitalize — text capitalization behavior for input
  • autofocus — automatic focus on page load
  • contenteditable — whether content is user-editable
  • draggable — whether the element can be dragged
  • enterkeyhint — virtual keyboard enter key label
  • inert — makes element and descendants non-interactive
  • inputmode — virtual keyboard optimization hint
  • popover — designates element as a popover
  • spellcheck — whether spelling should be checked
Since:
2026
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • VisualElement

      public VisualElement()
      Constructs a new VisualElement with default initialization.
    • VisualElement

      public VisualElement(String tagName)
      Constructs a new VisualElement with the specified HTML tag name.
      Parameters:
      tagName - The HTML tag name (e.g., "div", "span", "button").
    • VisualElement

      public VisualElement(String tagName, boolean closed)
      Constructs a new VisualElement with the specified HTML tag name and tag type.
      Parameters:
      tagName - The HTML tag name.
      closed - true for closed tags, false for self-closing tags.
  • Method Details

    • setAccessKey

      public T setAccessKey(String accessKey)
      Sets the accesskey attribute for keyboard shortcuts.
      Parameters:
      accessKey - The access key character.
      Returns:
      This element for method chaining.
    • setAutoCapitalize

      public T setAutoCapitalize(String autoCapitalize)
      Sets the autocapitalize attribute for text input behavior.
      Parameters:
      autoCapitalize - The autocapitalize value (none, sentences, words, characters).
      Returns:
      This element for method chaining.
    • setAutoFocus

      public T setAutoFocus(boolean autoFocus)
      Sets the autofocus boolean attribute.

      Indicates that the element should automatically get focus when the page loads. Used on <button>, <input>, <select>, and <textarea> elements. Only one element per page should have autofocus.

      Parameters:
      autoFocus - True to enable autofocus, false to remove.
      Returns:
      This element for method chaining.
    • setDisabled

      public T setDisabled(boolean disabled)
      Sets the disabled boolean attribute.

      Indicates that the element should be disabled, preventing user interaction and form submission. Used on <button>, <fieldset>, <input>, <select>, and <textarea> elements. Disabled elements are typically rendered in a grayed-out style.

      Parameters:
      disabled - True to disable, false to enable.
      Returns:
      This element for method chaining.
    • enable

      public void enable()
      Enables this element by removing the disabled attribute.

      Convenience method equivalent to setDisabled(false). If the element was previously disabled, the onEnabled() hook is called.

      See Also:
    • disable

      public void disable()
      Disables this element by setting the disabled attribute.

      Convenience method equivalent to setDisabled(true). If the element was previously enabled, the onDisabled() hook is called.

      See Also:
    • isDisabled

      public boolean isDisabled()
      Returns whether the disabled attribute is set.

      The disabled attribute prevents the user from interacting with the element. Used on <button>, <fieldset>, <input>, <optgroup>, <option>, <select>, and <textarea> elements. Disabled elements are not submitted with forms.

      Returns:
      true if disabled is present, false otherwise.
    • setContentEditable

      public T setContentEditable(boolean contentEditable)
      Sets the contenteditable attribute.
      Parameters:
      contentEditable - True to make editable, false to make non-editable.
      Returns:
      This element for method chaining.
    • setDraggable

      public T setDraggable(boolean draggable)
      Sets whether this element is draggable and registers the Oorian drag event handlers.

      Sets the HTML draggable attribute and wires up the framework's oorian.dragndrop JavaScript handlers for drag start, drag end, and drag exit events.

      Parameters:
      draggable - true to make the element draggable, false otherwise.
      Returns:
      This element for method chaining.
    • setDropAllowed

      public T setDropAllowed(boolean flag)
      Sets whether this element accepts dropped items and registers the Oorian drop event handlers.

      When enabled, wires up the framework's oorian.dragndrop JavaScript handlers for drag enter, drag leave, drag over, and drop events. When disabled, removes those handlers.

      Parameters:
      flag - true to allow drops on this element, false to remove drop handlers.
      Returns:
      This element for method chaining.
    • setEnterKeyHint

      public T setEnterKeyHint(String enterKeyHint)
      Sets the enterkeyhint attribute.
      Parameters:
      enterKeyHint - The enter key hint value (enter, done, go, next, previous, search, send).
      Returns:
      This element for method chaining.
    • setInert

      public T setInert(boolean inert)
      Sets the inert boolean attribute.
      Parameters:
      inert - True to make inert, false to remove.
      Returns:
      This element for method chaining.
    • setInputMode

      public T setInputMode(String inputMode)
      Sets the inputmode attribute.
      Parameters:
      inputMode - The input mode value (none, text, decimal, numeric, tel, search, email, url).
      Returns:
      This element for method chaining.
    • setPopover

      public T setPopover(String popover)
      Sets the popover attribute.
      Parameters:
      popover - The popover value (auto, manual).
      Returns:
      This element for method chaining.
    • setSpellCheck

      public T setSpellCheck(boolean spellCheck)
      Sets the spellcheck attribute.
      Parameters:
      spellCheck - True to enable spell checking, false to disable.
      Returns:
      This element for method chaining.
    • setTitle

      public T setTitle(String title)
      Sets the title attribute for this element.

      The title typically appears as a tooltip when the user hovers over the element.

      Parameters:
      title - The title text.
      Returns:
      This element for method chaining.
    • setTabIndex

      public final T setTabIndex(int index)
      Sets the tab index for keyboard navigation.

      Elements with a lower tab index are focused first. A tab index of 0 makes the element focusable in the natural document order. A negative tab index removes the element from the tab order.

      Parameters:
      index - The tab index value.
      Returns:
      This element for method chaining.
    • setTooltip

      public T setTooltip(String tooltip)
      Sets the tooltip text displayed when the user hovers over this element. This does the same thing as setTitle
      Parameters:
      tooltip - The tooltip text.
      Returns:
    • setHidden

      public T setHidden(boolean hidden)
      Sets the hidden boolean attribute.

      When present, the element is not yet or no longer relevant.

      Parameters:
      hidden - True to hide the element, false to show.
      Returns:
      This element for method chaining.
    • setAriaLabel

      public T setAriaLabel(String label)
      Sets the aria-label attribute for screen readers.

      Use when the element's visible text doesn't adequately describe its purpose. This provides an accessible name that overrides any other labeling mechanism.

      Parameters:
      label - The accessible label text.
      Returns:
      This element for method chaining.
    • setAriaLabelledBy

      public T setAriaLabelledBy(String elementId)
      Sets aria-labelledby to reference another element's ID.

      The referenced element's text content becomes the accessible name for this element. Multiple IDs can be provided, space-separated, to concatenate labels.

      Parameters:
      elementId - ID of the element containing the label text.
      Returns:
      This element for method chaining.
    • setAriaDescribedBy

      public T setAriaDescribedBy(String elementIds)
      Sets aria-describedby to reference element(s) providing additional description.

      Unlike aria-labelledby, this provides supplementary information about the element, not the primary label. Screen readers typically announce this after the label.

      Parameters:
      elementIds - Space-separated IDs of elements providing descriptions.
      Returns:
      This element for method chaining.
    • setRole

      public T setRole(AriaRole role)
      Sets the ARIA role attribute using the AriaRole enum.

      Roles define what an element is or does, providing semantic meaning to assistive technologies. Use roles when native HTML elements don't convey the intended semantics.

      Parameters:
      role - The ARIA role.
      Returns:
      This element for method chaining.
    • setRole

      public T setRole(String role)
      Sets the ARIA role attribute using a string value.

      Use this overload for custom roles or roles not defined in the AriaRole enum.

      Parameters:
      role - The ARIA role string.
      Returns:
      This element for method chaining.
    • setAriaHidden

      public T setAriaHidden(boolean hidden)
      Hides or shows the element from assistive technology.

      When true, the element and all its descendants are hidden from screen readers. Use for decorative content or content that is duplicated elsewhere accessibly.

      Parameters:
      hidden - True to hide from screen readers, false to show.
      Returns:
      This element for method chaining.
    • setAriaExpanded

      public T setAriaExpanded(boolean expanded)
      Marks element as expanded or collapsed (for disclosure widgets).

      Use on elements that control the visibility of other content, such as accordion headers, dropdown buttons, or tree item expanders.

      Parameters:
      expanded - True if the controlled content is visible, false if hidden.
      Returns:
      This element for method chaining.
    • setAriaPressed

      public T setAriaPressed(Boolean pressed)
      Marks element as pressed (for toggle buttons).

      Use on buttons that have a pressed/unpressed state, like bold or italic buttons in a text editor.

      Parameters:
      pressed - True if pressed, false if not pressed, null to remove.
      Returns:
      This element for method chaining.
    • setAriaSelected

      public T setAriaSelected(boolean selected)
      Marks element as selected.

      Use on elements that can be selected, such as options in a listbox, tabs in a tablist, or rows in a grid.

      Parameters:
      selected - True if selected, false if not selected.
      Returns:
      This element for method chaining.
    • setAriaDisabled

      public T setAriaDisabled(boolean disabled)
      Marks element as disabled for assistive technology.

      This should be used in conjunction with visual disabled styling. Unlike the HTML disabled attribute, aria-disabled doesn't prevent interaction.

      Parameters:
      disabled - True if disabled, false if enabled.
      Returns:
      This element for method chaining.
    • setAriaCurrent

      public T setAriaCurrent(AriaCurrent current)
      Sets aria-current for navigation/pagination.

      Indicates the current item within a set of related elements, such as the current page in navigation or current step in a wizard.

      Parameters:
      current - The type of current indicator.
      Returns:
      This element for method chaining.
    • setAriaLive

      public T setAriaLive(AriaLive politeness)
      Creates a live region that announces changes to screen readers.

      Live regions notify users of dynamic content changes without requiring focus to move to the changed content.

      Parameters:
      politeness - POLITE waits for user idle, ASSERTIVE interrupts immediately.
      Returns:
      This element for method chaining.
    • setAriaAtomic

      public T setAriaAtomic(boolean atomic)
      Specifies what changes should be announced in a live region.

      When true, the entire live region is announced on any change. When false, only the changed portions are announced.

      Parameters:
      atomic - True to announce entire region, false for just changes.
      Returns:
      This element for method chaining.
    • setAriaControls

      public T setAriaControls(String elementId)
      Indicates the element controls another element.

      Use when an element controls the display or content of another element, such as a button that opens a menu or expands a section.

      Parameters:
      elementId - ID of the controlled element.
      Returns:
      This element for method chaining.
    • setAriaOwns

      public T setAriaOwns(String elementIds)
      Indicates an element owns another (for parent-child relationships not in DOM).

      Use when the visual/logical parent-child relationship differs from the DOM structure, such as with popup menus or drag-and-drop.

      Parameters:
      elementIds - Space-separated IDs of owned elements.
      Returns:
      This element for method chaining.
    • setAriaValueRange

      public T setAriaValueRange(Number value, Number min, Number max)
      Sets the value for range widgets (sliders, progress bars).

      Provides the current value and acceptable range for range-based widgets.

      Parameters:
      value - Current value.
      min - Minimum value.
      max - Maximum value.
      Returns:
      This element for method chaining.
    • setAriaValueText

      public T setAriaValueText(String text)
      Sets human-readable value text for range widgets.

      Use when the numeric value doesn't convey meaning, such as "Medium" for a slider or "Step 2 of 5" for progress.

      Parameters:
      text - The value as text.
      Returns:
      This element for method chaining.
    • setAriaHasPopup

      public T setAriaHasPopup(boolean hasPopup)
      Indicates element has a popup.

      Use on elements that trigger popups like menus or dialogs.

      Parameters:
      hasPopup - True if element triggers a popup.
      Returns:
      This element for method chaining.
    • setAriaHasPopup

      public T setAriaHasPopup(AriaPopupType popupType)
      Indicates element has a popup of a specific type.

      Provides more detail about the popup type for screen readers.

      Parameters:
      popupType - Type of popup (menu, listbox, tree, grid, dialog).
      Returns:
      This element for method chaining.
    • setAriaInvalid

      public T setAriaInvalid(boolean invalid)
      Sets aria-invalid for form validation.

      Indicates that the entered value does not conform to the expected format.

      Parameters:
      invalid - True if field has invalid input.
      Returns:
      This element for method chaining.
    • setAriaErrorMessage

      public T setAriaErrorMessage(String elementId)
      Sets aria-errormessage to reference error text element.

      Points to an element containing an error message for this element. The error message element should be visible when aria-invalid is true.

      Parameters:
      elementId - ID of error message element.
      Returns:
      This element for method chaining.
    • setAriaRequired

      public T setAriaRequired(boolean required)
      Sets aria-required for form fields.

      Indicates that user input is required before form submission.

      Parameters:
      required - True if field is required.
      Returns:
      This element for method chaining.
    • setAriaChecked

      public T setAriaChecked(boolean checked)
      Sets aria-checked for checkable elements.

      Indicates the current checked state of checkboxes, radio buttons, and other checkable widgets. Use "mixed" for partially checked states.

      Parameters:
      checked - True if checked, false if unchecked.
      Returns:
      This element for method chaining.
    • setAriaCheckedMixed

      public T setAriaCheckedMixed()
      Sets aria-checked to mixed state for partially checked elements.

      Use for parent checkboxes where some children are checked and some are not.

      Returns:
      This element for method chaining.
    • setAriaBusy

      public T setAriaBusy(boolean busy)
      Sets aria-busy to indicate content is being updated.

      While true, assistive technologies may ignore changes to the element. Set to false when updates are complete.

      Parameters:
      busy - True if content is updating, false when complete.
      Returns:
      This element for method chaining.
    • setAriaLevel

      public T setAriaLevel(int level)
      Sets aria-level for hierarchical elements.

      Indicates the hierarchical level of an element within a structure, such as headings (1-6) or tree items.

      Parameters:
      level - The hierarchical level (1 or greater).
      Returns:
      This element for method chaining.
    • setAriaModal

      public T setAriaModal(boolean modal)
      Sets aria-modal to indicate a dialog is modal.

      When true, indicates that the dialog prevents interaction with other content on the page until dismissed.

      Parameters:
      modal - True if the dialog is modal.
      Returns:
      This element for method chaining.
    • setConsumeEvent

      public final T setConsumeEvent(boolean consume)
      Sets whether this element should consume (stop propagation of) events.
      Parameters:
      consume - If true, events on this element will not bubble to parent elements.
      Returns:
      This element for method chaining.
    • getAccessKey

      public String getAccessKey()
      Returns the accesskey attribute value.
      Returns:
      The access key, or null if not set.
    • getAutoCapitalize

      public String getAutoCapitalize()
      Returns the autocapitalize attribute value.
      Returns:
      The autocapitalize value, or null if not set.
    • isAutoFocus

      public boolean isAutoFocus()
      Returns whether the autofocus attribute is set.
      Returns:
      true if the element has autofocus, false otherwise.
    • isContentEditable

      public boolean isContentEditable()
      Returns whether contenteditable is enabled.
      Returns:
      true if the element is content editable, false otherwise.
    • isDraggable

      public boolean isDraggable()
      Returns whether the element is draggable.
      Returns:
      true if draggable, false otherwise.
    • getEnterKeyHint

      public String getEnterKeyHint()
      Returns the enterkeyhint attribute value.
      Returns:
      The enter key hint, or null if not set.
    • isInert

      public boolean isInert()
      Returns whether the inert attribute is set.
      Returns:
      true if the element is inert, false otherwise.
    • getInputMode

      public String getInputMode()
      Returns the inputmode attribute value.
      Returns:
      The input mode, or null if not set.
    • getPopover

      public String getPopover()
      Returns the popover attribute value.
      Returns:
      The popover value, or null if not set.
    • isSpellCheck

      public boolean isSpellCheck()
      Returns whether spellcheck is enabled.
      Returns:
      true if spellcheck is enabled, false otherwise.
    • getTitle

      public String getTitle()
      Returns the title attribute value.
      Returns:
      The title text, or null if not set.
    • getTabIndex

      public int getTabIndex()
      Returns the tabindex attribute value.
      Returns:
      The tab index, or 0 if not set.
    • isHidden

      public boolean isHidden()
      Returns whether the hidden attribute is set.
      Returns:
      true if the element is hidden, false otherwise.
    • getRole

      public String getRole()
      Returns the role attribute value.
      Returns:
      The ARIA role, or null if not set.
    • setFocus

      public void setFocus()
      Sets focus on this element.

      Uses the framework's SelectionApi to programmatically focus this element.

    • setOnClick

      public void setOnClick(String value)
      Sets the JavaScript onclick event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the element is clicked.
    • clearOnClick

      public void clearOnClick()
      Removes the onclick event handler from this element.
    • setOnClickChange

      public void setOnClickChange(String id)
      Sets the onclick handler to toggle a CSS class change on the specified element.
      Parameters:
      id - The ID of the element to toggle.
    • setOnClickNavigateBack

      public void setOnClickNavigateBack()
      Sets the onclick handler to navigate the browser back one page in history.
    • setOnClickNavigateTo

      public void setOnClickNavigateTo(String url)
      Sets the onclick handler to navigate the browser to the specified URL. The URL is resolved through HtmlPage.resolveUrl(String) to ensure correct context path handling.
      Parameters:
      url - The URL to navigate to when this element is clicked.
    • setOnClickNavigateBack

      public void setOnClickNavigateBack(int pages)
      Sets the onclick handler to navigate the browser back the specified number of pages in history.
      Parameters:
      pages - The number of pages to navigate back.
    • setOnClickNavigateBack

      public void setOnClickNavigateBack(String url)
      Sets the onclick handler to navigate the browser back to the specified URL in history. The URL is resolved through HtmlPage.resolveUrl(String) to ensure correct context path handling.
      Parameters:
      url - The URL to navigate back to in the browser history.
    • setOnClickNavigateForward

      public void setOnClickNavigateForward()
      Sets the onclick handler to navigate the browser forward one page in history.
    • setOnClickNavigateForward

      public void setOnClickNavigateForward(int pages)
      Sets the onclick handler to navigate the browser forward the specified number of pages in history.
      Parameters:
      pages - The number of pages to navigate forward.
    • setOnClickNavigateForward

      public void setOnClickNavigateForward(String url)
      Sets the onclick handler to navigate the browser forward to the specified URL in history. The URL is resolved through HtmlPage.resolveUrl(String) to ensure correct context path handling.
      Parameters:
      url - The URL to navigate forward to in the browser history.
    • setOnDblClick

      public void setOnDblClick(String value)
      Sets the JavaScript ondblclick event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the element is double-clicked.
    • setOnDblClickChange

      public void setOnDblClickChange(String id)
      Sets the ondblclick handler to toggle a CSS class change on the specified element.
      Parameters:
      id - The ID of the element to toggle.
    • setOnFocus

      public void setOnFocus(String value)
      Sets the JavaScript onfocus event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the element receives focus.
    • setOnBlur

      public void setOnBlur(String value)
      Sets the JavaScript onblur event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the element loses focus.
    • setOnKeyDown

      public void setOnKeyDown(String value)
      Sets the JavaScript onkeydown event handler for this element.
      Parameters:
      value - The JavaScript code to execute when a key is pressed down.
    • setOnKeyPressed

      public void setOnKeyPressed(String value)
      Sets the JavaScript onkeypress event handler for this element.
      Parameters:
      value - The JavaScript code to execute when a key is pressed.
    • setOnKeyUp

      public void setOnKeyUp(String value)
      Sets the JavaScript onkeyup event handler for this element.
      Parameters:
      value - The JavaScript code to execute when a key is released.
    • setOnMouseDown

      public void setOnMouseDown(String value)
      Sets the JavaScript onmousedown event handler for this element.
      Parameters:
      value - The JavaScript code to execute when a mouse button is pressed on the element.
    • setOnMouseMove

      public void setOnMouseMove(String value)
      Sets the JavaScript onmousemove event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the mouse moves over the element.
    • setOnMouseOver

      public void setOnMouseOver(String value)
      Sets the JavaScript onmouseover event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the mouse enters the element.
    • setOnMouseOverChangeStyle

      public void setOnMouseOverChangeStyle(String elementId, CssStyle style)
      Sets the onmouseover handler to change the style of the specified element using a CssStyle.
      Parameters:
      elementId - The ID of the element whose style will change.
      style - The CssStyle to apply on mouse over.
    • setOnMouseOverChangeStyle

      public void setOnMouseOverChangeStyle(String elementId, String style)
      Sets the onmouseover handler to change the style of the specified element.
      Parameters:
      elementId - The ID of the element whose style will change.
      style - The inline CSS style string to apply on mouse over.
    • setOnMouseOverChangeClass

      public void setOnMouseOverChangeClass(String elementId, String className)
      Sets the onmouseover handler to change the CSS class of the specified element.
      Parameters:
      elementId - The ID of the element whose class will change.
      className - The CSS class name to apply on mouse over.
    • setOnMouseOut

      public void setOnMouseOut(String value)
      Sets the JavaScript onmouseout event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the mouse leaves the element.
    • setOnMouseOutChangeStyle

      public void setOnMouseOutChangeStyle(String elementId, CssStyle style)
      Sets the onmouseout handler to change the style of the specified element using a CssStyle.
      Parameters:
      elementId - The ID of the element whose style will change.
      style - The CssStyle to apply on mouse out.
    • setOnMouseOutChangeStyle

      public void setOnMouseOutChangeStyle(String elementId, String style)
      Sets the onmouseout handler to change the style of the specified element.
      Parameters:
      elementId - The ID of the element whose style will change.
      style - The inline CSS style string to apply on mouse out.
    • setOnMouseOutChangeClass

      public void setOnMouseOutChangeClass(String elementId, String className)
      Sets the onmouseout handler to change the CSS class of the specified element.
      Parameters:
      elementId - The ID of the element whose class will change.
      className - The CSS class name to apply on mouse out.
    • setOnMouseOverShow

      public void setOnMouseOverShow(String elementId)
      Sets mouse over/out handlers to show an element on hover and hide it when the mouse leaves.
      Parameters:
      elementId - The ID of the element to show on mouse over and hide on mouse out.
    • setOnMouseUp

      public void setOnMouseUp(String value)
      Sets the JavaScript onmouseup event handler for this element.
      Parameters:
      value - The JavaScript code to execute when a mouse button is released on the element.
    • setOnWheel

      public void setOnWheel(String value)
      Sets the JavaScript onwheel event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the mouse wheel is scrolled over the element.
    • setOnResize

      public void setOnResize(String value)
      Sets the JavaScript onresize event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the element is resized.
    • setOnChange

      public void setOnChange(String value)
      Sets the JavaScript onchange event handler for this element.
      Parameters:
      value - The JavaScript code to execute when the element's value changes.
    • setOnPageLoad

      public void setOnPageLoad(String value)
      Sets a JavaScript handler to execute when the page finishes loading.

      Uses the framework's data-onPageLoad attribute convention.

      Parameters:
      value - The JavaScript code to execute on page load.
    • setOnWindowResize

      public void setOnWindowResize(String value)
      Sets a JavaScript handler to execute when the browser window is resized.

      Uses the framework's data-onWindowResize attribute convention.

      Parameters:
      value - The JavaScript code to execute on window resize.
    • setOnDocumentResize

      public void setOnDocumentResize(String value)
      Sets a JavaScript handler to execute when the document is resized.

      Uses the framework's data-onDocumentResize attribute convention.

      Parameters:
      value - The JavaScript code to execute on document resize.
    • setOnAuxClick

      public void setOnAuxClick(String value)
      Sets the JavaScript onauxclick event handler for this element.

      Fires when a non-primary button (e.g., middle or right mouse button) is clicked.

      Parameters:
      value - The JavaScript code to execute on auxiliary click.
    • setOnContextMenu

      public void setOnContextMenu(String value)
      Sets the JavaScript oncontextmenu event handler for this element.

      Fires when the user attempts to open a context menu (typically right-click).

      Parameters:
      value - The JavaScript code to execute on context menu.
    • setOnMouseEnter

      public void setOnMouseEnter(String value)
      Sets the JavaScript onmouseenter event handler for this element.

      Fires when the mouse enters the element. Unlike onmouseover, this event does not bubble and does not fire when entering descendant elements.

      Parameters:
      value - The JavaScript code to execute when the mouse enters.
    • setOnMouseLeave

      public void setOnMouseLeave(String value)
      Sets the JavaScript onmouseleave event handler for this element.

      Fires when the mouse leaves the element. Unlike onmouseout, this event does not bubble and does not fire when leaving to descendant elements.

      Parameters:
      value - The JavaScript code to execute when the mouse leaves.
    • setOnFocusIn

      public void setOnFocusIn(String value)
      Sets the JavaScript onfocusin event handler for this element.

      Fires when the element or a descendant receives focus. Unlike onfocus, this event bubbles.

      Parameters:
      value - The JavaScript code to execute on focus in.
    • setOnFocusOut

      public void setOnFocusOut(String value)
      Sets the JavaScript onfocusout event handler for this element.

      Fires when the element or a descendant loses focus. Unlike onblur, this event bubbles.

      Parameters:
      value - The JavaScript code to execute on focus out.
    • setOnInput

      public void setOnInput(String value)
      Sets the JavaScript oninput event handler for this element.

      Fires synchronously when the value of an <input>, <textarea>, or <select> element is changed. Unlike onchange, this fires immediately on every modification.

      Parameters:
      value - The JavaScript code to execute on input.
    • setOnInvalid

      public void setOnInvalid(String value)
      Sets the JavaScript oninvalid event handler for this element.

      Fires when a form element fails constraint validation.

      Parameters:
      value - The JavaScript code to execute on invalid.
    • setOnSelect

      public void setOnSelect(String value)
      Sets the JavaScript onselect event handler for this element.

      Fires when text within an input or textarea is selected.

      Parameters:
      value - The JavaScript code to execute on text selection.
    • setOnFormData

      public void setOnFormData(String value)
      Sets the JavaScript onformdata event handler for this element.

      Fires when the form's data is constructed, after form submission is initiated.

      Parameters:
      value - The JavaScript code to execute on form data construction.
    • setOnCopy

      public void setOnCopy(String value)
      Sets the JavaScript oncopy event handler for this element.

      Fires when the user copies content from this element.

      Parameters:
      value - The JavaScript code to execute on copy.
    • setOnCut

      public void setOnCut(String value)
      Sets the JavaScript oncut event handler for this element.

      Fires when the user cuts content from this element.

      Parameters:
      value - The JavaScript code to execute on cut.
    • setOnPaste

      public void setOnPaste(String value)
      Sets the JavaScript onpaste event handler for this element.

      Fires when the user pastes content into this element.

      Parameters:
      value - The JavaScript code to execute on paste.
    • setOnPointerDown

      public void setOnPointerDown(String value)
      Sets the JavaScript onpointerdown event handler for this element.

      Fires when a pointer (mouse, pen, or touch) becomes active over this element.

      Parameters:
      value - The JavaScript code to execute on pointer down.
    • setOnPointerUp

      public void setOnPointerUp(String value)
      Sets the JavaScript onpointerup event handler for this element.

      Fires when a pointer is released over this element.

      Parameters:
      value - The JavaScript code to execute on pointer up.
    • setOnPointerMove

      public void setOnPointerMove(String value)
      Sets the JavaScript onpointermove event handler for this element.

      Fires when a pointer moves while over this element.

      Parameters:
      value - The JavaScript code to execute on pointer move.
    • setOnPointerOver

      public void setOnPointerOver(String value)
      Sets the JavaScript onpointerover event handler for this element.

      Fires when a pointer enters this element or one of its descendants. This event bubbles.

      Parameters:
      value - The JavaScript code to execute on pointer over.
    • setOnPointerOut

      public void setOnPointerOut(String value)
      Sets the JavaScript onpointerout event handler for this element.

      Fires when a pointer leaves this element or moves to a descendant. This event bubbles.

      Parameters:
      value - The JavaScript code to execute on pointer out.
    • setOnPointerEnter

      public void setOnPointerEnter(String value)
      Sets the JavaScript onpointerenter event handler for this element.

      Fires when a pointer enters this element. Unlike onpointerover, this event does not bubble.

      Parameters:
      value - The JavaScript code to execute on pointer enter.
    • setOnPointerLeave

      public void setOnPointerLeave(String value)
      Sets the JavaScript onpointerleave event handler for this element.

      Fires when a pointer leaves this element. Unlike onpointerout, this event does not bubble.

      Parameters:
      value - The JavaScript code to execute on pointer leave.
    • setOnPointerCancel

      public void setOnPointerCancel(String value)
      Sets the JavaScript onpointercancel event handler for this element.

      Fires when the browser determines a pointer event is unlikely to produce further events (e.g., due to a hardware event).

      Parameters:
      value - The JavaScript code to execute on pointer cancel.
    • setOnGotPointerCapture

      public void setOnGotPointerCapture(String value)
      Sets the JavaScript ongotpointercapture event handler for this element.

      Fires when this element receives pointer capture via setPointerCapture().

      Parameters:
      value - The JavaScript code to execute when pointer capture is acquired.
    • setOnLostPointerCapture

      public void setOnLostPointerCapture(String value)
      Sets the JavaScript onlostpointercapture event handler for this element.

      Fires when this element loses pointer capture.

      Parameters:
      value - The JavaScript code to execute when pointer capture is lost.
    • setOnTouchStart

      public void setOnTouchStart(String value)
      Sets the JavaScript ontouchstart event handler for this element.

      Fires when one or more touch points are placed on the touch surface.

      Parameters:
      value - The JavaScript code to execute on touch start.
    • setOnTouchEnd

      public void setOnTouchEnd(String value)
      Sets the JavaScript ontouchend event handler for this element.

      Fires when one or more touch points are removed from the touch surface.

      Parameters:
      value - The JavaScript code to execute on touch end.
    • setOnTouchMove

      public void setOnTouchMove(String value)
      Sets the JavaScript ontouchmove event handler for this element.

      Fires when one or more touch points are moved along the touch surface.

      Parameters:
      value - The JavaScript code to execute on touch move.
    • setOnTouchCancel

      public void setOnTouchCancel(String value)
      Sets the JavaScript ontouchcancel event handler for this element.

      Fires when one or more touch points are disrupted in an implementation-specific manner (e.g., too many touch points are created).

      Parameters:
      value - The JavaScript code to execute on touch cancel.
    • setOnAnimationStart

      public void setOnAnimationStart(String value)
      Sets the JavaScript onanimationstart event handler for this element.

      Fires when a CSS animation starts playing.

      Parameters:
      value - The JavaScript code to execute on animation start.
    • setOnAnimationEnd

      public void setOnAnimationEnd(String value)
      Sets the JavaScript onanimationend event handler for this element.

      Fires when a CSS animation completes.

      Parameters:
      value - The JavaScript code to execute on animation end.
    • setOnAnimationIteration

      public void setOnAnimationIteration(String value)
      Sets the JavaScript onanimationiteration event handler for this element.

      Fires when a CSS animation completes one iteration and begins the next.

      Parameters:
      value - The JavaScript code to execute on animation iteration.
    • setOnAnimationCancel

      public void setOnAnimationCancel(String value)
      Sets the JavaScript onanimationcancel event handler for this element.

      Fires when a CSS animation is cancelled unexpectedly (e.g., the element is removed or the animation is removed from the element).

      Parameters:
      value - The JavaScript code to execute on animation cancel.
    • setOnTransitionStart

      public void setOnTransitionStart(String value)
      Sets the JavaScript ontransitionstart event handler for this element.

      Fires when a CSS transition starts.

      Parameters:
      value - The JavaScript code to execute on transition start.
    • setOnTransitionEnd

      public void setOnTransitionEnd(String value)
      Sets the JavaScript ontransitionend event handler for this element.

      Fires when a CSS transition completes.

      Parameters:
      value - The JavaScript code to execute on transition end.
    • setOnTransitionRun

      public void setOnTransitionRun(String value)
      Sets the JavaScript ontransitionrun event handler for this element.

      Fires when a CSS transition is first created (before the transition delay).

      Parameters:
      value - The JavaScript code to execute on transition run.
    • setOnTransitionCancel

      public void setOnTransitionCancel(String value)
      Sets the JavaScript ontransitioncancel event handler for this element.

      Fires when a CSS transition is cancelled.

      Parameters:
      value - The JavaScript code to execute on transition cancel.
    • setOnScroll

      public void setOnScroll(String value)
      Sets the JavaScript onscroll event handler for this element.

      Fires when the element's scroll position changes.

      Parameters:
      value - The JavaScript code to execute on scroll.
    • setOnScrollEnd

      public void setOnScrollEnd(String value)
      Sets the JavaScript onscrollend event handler for this element.

      Fires when the scroll position has finished changing (scrolling has stopped).

      Parameters:
      value - The JavaScript code to execute on scroll end.
    • setOnToggle

      public void setOnToggle(String value)
      Sets the JavaScript ontoggle event handler for this element.

      Fires when a <details> element or popover is opened or closed.

      Parameters:
      value - The JavaScript code to execute on toggle.
    • setOnBeforeToggle

      public void setOnBeforeToggle(String value)
      Sets the JavaScript onbeforetoggle event handler for this element.

      Fires before a <details> element or popover changes its open/closed state.

      Parameters:
      value - The JavaScript code to execute before toggle.
    • setOnSelectStart

      public void setOnSelectStart(String value)
      Sets the JavaScript onselectstart event handler for this element.

      Fires when the user begins a new selection.

      Parameters:
      value - The JavaScript code to execute on selection start.
    • setOnSelectionChange

      public void setOnSelectionChange(String value)
      Sets the JavaScript onselectionchange event handler for this element.

      Fires when the current text selection changes.

      Parameters:
      value - The JavaScript code to execute on selection change.
    • setOnBeforeInput

      public void setOnBeforeInput(String value)
      Sets the JavaScript onbeforeinput event handler for this element.

      Fires before the DOM is updated as a result of user input (e.g., typing, pasting). This event is cancellable, allowing input to be prevented.

      Parameters:
      value - The JavaScript code to execute before input.
    • setOnCompositionStart

      public void setOnCompositionStart(String value)
      Sets the JavaScript oncompositionstart event handler for this element.

      Fires when an IME (Input Method Editor) composition session begins (e.g., for CJK character input).

      Parameters:
      value - The JavaScript code to execute on composition start.
    • setOnCompositionUpdate

      public void setOnCompositionUpdate(String value)
      Sets the JavaScript oncompositionupdate event handler for this element.

      Fires when a new character is received during an IME composition session.

      Parameters:
      value - The JavaScript code to execute on composition update.
    • setOnCompositionEnd

      public void setOnCompositionEnd(String value)
      Sets the JavaScript oncompositionend event handler for this element.

      Fires when an IME composition session ends (e.g., the user commits or cancels the composed text).

      Parameters:
      value - The JavaScript code to execute on composition end.
    • click

      public void click()
      Simulates a click on this element.

      Sends a click command to the client to trigger a click event on this element.

    • onDisabled

      protected void onDisabled()
      Called when this element transitions from enabled to disabled.

      Subclasses can override this hook to perform additional actions when the element becomes disabled, such as updating child element states, changing visual appearance, or deregistering event listeners. The default implementation does nothing.

      This hook is only called when the disabled state actually changes — calling setDisabled(true) on an already-disabled element will not trigger this method.

      See Also:
    • onEnabled

      protected void onEnabled()
      Called when this element transitions from disabled to enabled.

      Subclasses can override this hook to perform additional actions when the element becomes enabled, such as restoring child element states, updating visual appearance, or re-registering event listeners. The default implementation does nothing.

      This hook is only called when the disabled state actually changes — calling setDisabled(false) on an already-enabled element will not trigger this method.

      See Also: