Re: [WICG/webcomponents] Form-associated custom elements: being a submit button (#814)

EisenbergEffect left a comment (WICG/webcomponents#814)

Here’s a list of **native platforms** that let you attach behavior to an existing component without subclassing. These platforms use the same mechanism to deliver their own platform-provided behaviors while also enabling developers to create their own.

### Windows / .NET XAML family

* **WPF:** XAML Behaviors (`Microsoft.Xaml.Behaviors.Wpf`) and **attached properties** you can apply to any element.
* **UWP / WinUI 3:** same XAML **attached properties** model; behaviors available via packages/Blend-style libraries.
* **Xamarin.Forms / .NET MAUI:** first-class **Behaviors** attachable in XAML to any control (validation, commands, gestures).
* **Avalonia UI:** **attached properties** and a Behaviors library patterned after XAML Behaviors.

### Apple platforms

* **UIKit (iOS/iPadOS):** attach **`UIGestureRecognizer`**/**interactions** (`UIDragInteraction`, `UIContextMenuInteraction`) to any `UIView`; **UIKit Dynamics** uses `UIDynamicBehavior` objects bound to items.
* **SwiftUI:** composable **`ViewModifier`** objects that add behavior/appearance without subclassing.
* **AppKit (macOS):** attach **`NSGestureRecognizer`** and other controllers to any `NSView`.

### Android

* **CoordinatorLayout.Behavior:** pluggable **`Behavior`** classes for child views (e.g., scrolling/collapsing).
* **Data Binding `@BindingAdapter`:** custom XML attributes that inject logic into existing views.
* **RecyclerView.ItemDecoration / ViewOutlineProvider:** attach drawing/layout/outline logic to existing views.
* **Jetpack Compose:** chainable **`Modifier`** objects add layout/interaction/semantics to any composable.

### Qt / QML

* **Attached properties** (e.g., `ListView.isCurrentItem`) and the QML **`Behavior`** type to attach animations/logic to property changes.

### GTK (GNOME)

* **Event controllers / gestures** (`GtkEventController`, `GtkGesture*`) are attachable objects bound to widgets.

### Game engines

* **Unity:** add one or more **`MonoBehaviour`** components to any `GameObject`.
* **Unreal Engine:** attach **`UActorComponent`** (and related components) to `AActor` for reusable behavior.
* **Godot:** attach scripts to **Nodes**; composition + signals, no subclassing required.

### Classic Windows (WinForms)

* **Extender providers** (`IExtenderProvider`) like **ToolTip**/**ErrorProvider** add properties/behavior to other controls.

### Cocoa (Objective-C / Swift)

* **Associated Objects:** `objc_setAssociatedObject` lets you **attach arbitrary objects/behaviors** to any instance (often from a category/extension).
* **Gesture Recognizers & Interactions:** `NSGestureRecognizer`/`UIGestureRecognizer`-style attachables on macOS/iOS family.
* **Layout Guides & Constraints:** attach `UILayoutGuide`/`NSLayoutConstraint` objects to views to change behavior without subclassing.

### Noesis (XAML for native/game UIs)

* **XAML attached properties** compatible with WPF semantics.
* **Interactivity/Behaviors** (Blend-style) that can be attached in XAML to existing elements to add commands, triggers, and animations.

Across **Windows, Apple, Android, Qt, GTK, and major game engines**, platforms provide a **first-class, attachable behavior** mechanism. It scales from simple gestures to complex coordination (scroll/collapse, physics, drag/drop) **without subclassing or wrapping**. The web would benefit from a similarly **composable, declarative “attach behavior to an existing element”** capability, orthogonal to frameworks, so authors can add interaction/semantics to any DOM node with clear lifecycle, cleanup, and encapsulation.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/814#issuecomment-3392854340
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/814/3392854340@github.com>

Received on Saturday, 11 October 2025 03:20:13 UTC