Skip to content

Make reflect work for ElementInternals - #8496

Merged
annevk merged 12 commits into
mainfrom
annevk/elementinternalsreflect
Feb 22, 2023
Merged

annevk merged 12 commits into
mainfrom
annevk/elementinternalsreflect

Conversation

@annevk

@annevk annevk commented Nov 11, 2022 •

Copy link
Copy Markdown
Member

@annevk
annevk marked this pull request as ready for review November 15, 2022 13:38
@annevk annevk added accessibility Affects accessibility topic: custom elements Relates to custom elements (as defined in DOM and HTML) labels Nov 15, 2022
@annevk
annevk requested a review from domenic November 15, 2022 13:43

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good start, but it has some issues... it's unclear how far we can get with a patch that just makes things a little better, versus doing the full rewrite of all reflection that I think both of us have had kicking around in our head for a while. If you do want to shave some yaks, I'm very supportive!

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks promising. Sorry for the long delay, and I'll try to be more responsive this time around!

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
@annevk
annevk force-pushed the annevk/elementinternalsreflect branch from 25e5809 to ab11d66 Compare February 16, 2023 16:10
@annevk

annevk commented Feb 16, 2023

Copy link
Copy Markdown
Member Author

If this generally looks good I'll make a more concerted effort to apply this throughout the whole section and tidy up some of the language as well as start working on the corresponding PRs that will be needed.

@annevk
annevk requested a review from domenic February 16, 2023 16:14

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Please proceed :)

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
@annevk

annevk commented Feb 17, 2023 •

Copy link
Copy Markdown
Member Author

Now that all the algorithms are converted:

  • Read through the section once more to see if it still makes sense.
  • Look at what needs updating around ElementInternals and perhaps have some kind of note pointing here.
  • Briefly investigate [Reflect] annotations to see how much additional work that would be at this point.
    • Formalize content attribute reflection #3238 (comment) still looks reasonable and I could see defining some kind of macro on top of this PR to tackle what is stated there. However:
      • The real value would be with enumerated attributes (especially nudging people in the direction of "limited to known values") and those are not tackled.
      • It doesn't handle the reflected target being a different object. I suspect that has to remain prose-only forever.
    • If we got [Reflect] sorted we would get rid of "support ElementInternals" again. That does seem like a worthy goal, but at this point I think I rather get there incrementally unless we have a very clear plan.
  • Figure out and write the updates to ARIA. Ideally as close to an editorial PR as possible.

Meanwhile I'd still appreciate drive-by review of course of what I managed to get done today.

@annevk

annevk commented Feb 20, 2023

Copy link
Copy Markdown
Member Author

While looking at ARIA I hit a bit of a snag, ARIA has a lot of spec-UB: w3c/aria#1110 (comment).

  • Then, when I was wondering if some could maybe be changed to use DOMString instead, I noticed that DOMString reflection does not account for the lack of a content attribute at the moment! I'm relatively sure that should be returning the empty string. That would be another normative "bug fix" made in this PR.

My current thinking is to leave some of the spec-UB in ARIA, but at least make it adopt this new framework. Thoughts?

One other thing I wanted to raise, should we rename "native accessibility semantics map" to something more neutral such as "internal content attribute map" so it can be used for other internal state as well, as needed? We could also do that later as there's not going to be many call sites.

annevk added a commit to annevk/aria that referenced this pull request Feb 20, 2023
This does not address most of the issues described in w3c#1110, but does provide a better base for ElementInternals support and tackling the issues in w3c#1110.

Corresponding HTML change: whatwg/html#8496.
@annevk
annevk requested a review from domenic February 20, 2023 17:40
@domenic

domenic commented Feb 21, 2023

Copy link
Copy Markdown
Member
  • Then, when I was wondering if some could maybe be changed to use DOMString instead, I noticed that DOMString reflection does not account for the lack of a content attribute at the moment! I'm relatively sure that should be returning the empty string. That would be another normative "bug fix" made in this PR.

Before #7956 it said

If a reflecting IDL attribute is a DOMString or USVString attribute but doesn't fall into any of the above categories, then the getting and setting must be done in a transparent, case-preserving manner.

which doesn't seem better. So yeah I guess this bug has been around for a long time.

One other thing I wanted to raise, should we rename "native accessibility semantics map" to something more neutral such as "internal content attribute map" so it can be used for other internal state as well, as needed? We could also do that later as there's not going to be many call sites.

Yes, I'd be in favor of that. Even if we never plan on expanding it to other attributes, it's a bit weird to have it be accessibility-named now that there's a general framework.

My current thinking is to leave some of the spec-UB in ARIA, but at least make it adopt this new framework. Thoughts?

Seems reasonable, but we should probably make addressing this the next priority in this area.

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, with some clarity-improvement suggestions. Happy to do another round of review though if needed.

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved

@domenic domenic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except maybe that intro bullets thing. I'll also check out the ARIA PR.

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
@annevk
annevk merged commit b739da3 into main Feb 22, 2023
@annevk
annevk deleted the annevk/elementinternalsreflect branch February 22, 2023 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Affects accessibility topic: custom elements Relates to custom elements (as defined in DOM and HTML)

Development

Successfully merging this pull request may close these issues.

ElementInternals's ARIAMixin

2 participants