-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom elements and remote resources #1913
Comments
I'm a bit wary here. Using custom elements for audio and video, aside from any other issue, is likely to be bad for accessibility. We removed the capability of doing custom audio/video controls from EPUB. Is there an existing reading system where a custom element with some sort of functionality would actually work? |
I don't know that it would be, since underlying the custom element is either a literal audio/video element or a direct inheritance from those elements. I haven't experimented with them much, but my understanding is that either the custom element is replaced by the contents of a template element (which would hold straight html), the HTML to render is written via script, or the audio/video element inherits whatever extra functionality the author has defined via the That's why there's a sort-of/almost way of finessing the requirement into custom elements, along the lines that when referenced from a custom element, the resource must still be used as defined in the restrictions. But there's no way to enforce that and I didn't have much luck trying to turn it into a sensible requirement. Custom elements are well supported in browser cores, so I expect that means reading system support is a mess. 😄 We can't really get rid of them now, though. |
Partly true... Safari doesn't support extending native elements with I'm going to try to see if I can get a test working. |
I think that is the crucial point: custom elements are there to stay. I am wary of creating too much deviation from the HTML standard. On the long term, we should "simply" take HTML as is. We do have some "discouraged constructs", and we may even add the custom elements to this list (using the same arguments than discouraged B.t.w., if there are accessibility issues with custom elements, I presume that is an issue for the HTML WG to solve. |
The issue was discussed in a meeting on 2021-12-03 List of resolutions:
View the transcript1. Custom elements and remote resources (issue epub-specs#1913)See github issue epub-specs#1913. Dave Cramer: first few issues are about remote resources. See github pull request epub-specs#1949. See github pull request epub-specs#1943. Dave Cramer: all of our previous conclusions are complicated by custom elements in HTML. Matt Garrish: right, there are 2 PRs, this one tries to find language that still works with our past intent, the other PR more specifically address the existence of custom elements. Dave Cramer: i made a test book for this, it worked in Apple and ADE, Kindle previewer failed because it doesn't support js, didn't work in Thorium. Ivan Herman: what you tested tells me that custom elements are here, it would be foolish of us to try to restrict them. They are part of the element that we have to deal with.
Matt Garrish: the simpler solution might be just to say that RS should not render remote resources in iframes. Dave Cramer: worried that people would then work around that by using a custom element to effectively make an iframe. Matt Garrish: there's more awareness of how to handle that at the RS level than at checking, because you have the DOM. Brady Duga: when it comes to scripting, it kind of the wild west. It'll be impossible to test whether scripts are being used to do something malicious. Ivan Herman: to be clear, custom elements mostly means scripting. As soon as RS allows scripting, any restriction on custom elements is meaningless. The real restriction is on scripting. Dave Cramer: there are 2 types of custom elements. First inherents from existing HTML element (i.e. "is" attribute). This type doesn't work in webkit, and will probably be limited in epub world..
Dave Cramer: I would warn everyone to be wary of custom elements, because it's easy to miss things related to a11y. HTML elements take care of a lot of that thinking for you. Ivan Herman: that's not really our fight, leave for WHAT WG. Dan Lazin: we use custom elements quite a bit in my day job, and there are more a11y friendly ways of doing it, but yes, beware. |
Now that we reference the WHATWG HTML spec, custom elements will become valid in EPUB 3.3, which are kind of the nightmare scenario for epubcheck since they aren't evaluated until documents load.
But putting aside the general inability to enforce rules on them, @rdeltour asked in w3c/epubcheck#1288 about their impact on the remote resource rules.
While I believe the underlying requirements remain valid, it's not easy to check how the resources will be used not knowing what the custom element extends or translates to from epubcheck.
So the possible options are:
I tend to lean toward the first option for pragmatic reasons -- it's probably what the second is going to force epubcheck to do anyway -- but if we want to keep the current specificity we could go with the second option.
The text was updated successfully, but these errors were encountered: