WICG / aom

Accessibility Object Model
http://wicg.github.io/aom/
Other
575 stars 59 forks source link

Web component semantics #127

Open alice opened 6 years ago

alice commented 6 years ago

https://github.com/w3c/webcomponents/issues/758 raises some doubts about using ShadowRoot to encapsulate semantics for web components.

I've written up two versions of some spec changes to try and formalise some of the ideas discussed in the explainer around web component semantics:

Would appreciate some guidance/discussion around these two options!

caridy commented 6 years ago

I will probably favor ElementSemantics at this point. Probably a different name, but I don't have a better alternative. IMO citizen developers usually reject the word "semantics" for whatever reason that I don't understand.

alice commented 6 years ago

On the pro-ShadowRoot side:

alice commented 6 years ago

On the pro-ElementSemantics side (sigh, naming):

SiTaggart commented 6 years ago

ElementSemantics for me too. It feels like the most familiar with what developers are currently accustomed to with regards to defining semantics on DOM nodes.

It also feels overly complicated to have 2 separate ways to achieve the same thing, so simplification is good.

And no need to attach a shadow root just to encapsulate semantics is a pro for me too

alice commented 6 years ago

@SiTaggart

It feels like the most familiar with what developers are currently accustomed to with regards to defining semantics on DOM nodes.

I don't quite follow. Any chance you could elaborate a little on this?

SiTaggart commented 6 years ago

Well, unless I'm completely misreading everything which is quite possible, with semantics only ever being defined by the element and it's object, it's directly familiar with what we have right now. An element defines it's semantic through attributes and it's API.

By placing some of an elements semantic meaning, or at least a way of defining it, onto it's shadowRoot, that's something totally alien to most seasoned developers in the world right now. My suspicion, and even to me now, a shadowRoot is just this mysterious thing that's not the element, and it being able to define semantics might just be jarring or weird.

Hopefully that makes some sense

alice commented 6 years ago

@SiTaggart That makes sense - I think the issue is with explaining how setting something on a completely separate node affects the host element, is that right?

Thanks for clarifying!

hayatoito commented 6 years ago

@alice Thank you for filing an issue. I prefer ElementSemantics here.

robdodson commented 6 years ago

+1 for ElementSemantics as well

SiTaggart commented 6 years ago

Yup, that sums it up nicely @alice

annevk commented 6 years ago

I used to favor ShadowRoot for this since it offers encapsulation, but ElementSemantics (indeed, naming might need work...) offers that too and can be used by custom elements that do not warrant a ShadowRoot. In addition I think this is worthwhile as ElementSemantics would only work for custom elements, whereas ShadowRoot also works for, e.g., h1 which already has some associated semantics. I think that would get rather muddy.

bkardell commented 6 years ago

ElementSemantics seems like it just 'fits' better than anything else I've seen proposed. Honestly, I don't even think that is a bad name.

robdodson commented 6 years ago

Should I be able to set tabindex as well using the ElementDefinitionOptions object? I realize it's not the same as semantics, but they are related and I'd want every instance to have the same behavior.

alice commented 6 years ago

@robdodson Check out the discussion over on https://github.com/w3c/webcomponents/issues/762