Skip to content

Expose certain behavioural attributes via ElementInternals #11752

@lukewarlow

Description

@lukewarlow

What problem are you trying to solve?

There are a number of platform behaviours that are available globally on any element via attributes, many of these are also inherent to some built-in elements. As a custom element author its common to want to replicate many of these built-in components or even to provide custom components that just share some behaviours.

<a href> and <img> for example have inherant draggability.

base appearance <select> has a popover internally.

<input type=radio>, <select> and the proposed <menubar> and <menulist> all have built-in arrow key navigation. See focusgroup for an attribute to expose this.

What solutions exist today?

Today a custom element author would have to sprout attributes inside of the connectedCallback() to enable these behaviours on their custom-elements, this is often undesirable.

How would you solve it?

It would be good if these behaviours were exposed via ElementInternals such that a custom element could use them without this implementation detail being exposed to consumers.

I believe that popover and draggable are both candidates for this, but there's possibly others (e.g. contenteditable?). focusgroup would also be a good example if it ever reached standards.

Anything else?

Note this is similar in topic to #11061 but I believe this is more scoped and would be useful regardless of that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interesttopic: custom elementsRelates to custom elements (as defined in DOM and HTML)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions