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
Dynamically defining exports from common #85
Dynamically defining exports from common #85
Conversation
If this approach is workable for you @jnurthen, it could be employed on any/all ARIA specs. |
we can't move to use data-export until w3c/respec#2825 is resolved |
Just noting that the dfn panel is a consumer of the definitions, but it shouldn't block this. |
@marcoscaceres I disagree. I cannot ship a spec with known accessibility errors in it. |
Ok, I'll look at adding a feature so you can disable the dfn panel in this spec. We can re-enable it once the aforementioned bug is fixed. Note, however, you are disadvantaging a larger set of users refusing to ship this even if the panel is a bit buggy - the panel still extremely useful for a significant number of users even if it can't currently be activated by keyboard. |
@jnurthen and I spoke on Slack about w3c/respec#2825 - Going to get some guidance on how best to fix w3c/respec#2825 from @jnurthen over on the other repo. I put up some suggestions. @aarongustafson, I'll try to review the code + changes here too ASAP. |
var definitions_to_export = [ "accessible name", "accessible description" ]; | ||
function exportDefinitions( utils, content, url ){ | ||
var $dfnDiv = document.createElement("div"), | ||
$dfns, | ||
i; | ||
$dfnDiv.innerHTML = content; | ||
$dfns = $dfnDiv.querySelectorAll('dfn:not([data-export])'); | ||
i = $dfns.length; | ||
while( i-- ) | ||
{ | ||
var text = $dfns[i].innerText.toLowerCase(); | ||
if ( definitions_to_export.indexOf( text ) > -1 ) | ||
{ | ||
$dfns[i].dataset.export = ""; | ||
} | ||
} | ||
return $dfnDiv.innerHTML; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var definitions_to_export = [ "accessible name", "accessible description" ]; | |
function exportDefinitions( utils, content, url ){ | |
var $dfnDiv = document.createElement("div"), | |
$dfns, | |
i; | |
$dfnDiv.innerHTML = content; | |
$dfns = $dfnDiv.querySelectorAll('dfn:not([data-export])'); | |
i = $dfns.length; | |
while( i-- ) | |
{ | |
var text = $dfns[i].innerText.toLowerCase(); | |
if ( definitions_to_export.indexOf( text ) > -1 ) | |
{ | |
$dfns[i].dataset.export = ""; | |
} | |
} | |
return $dfnDiv.innerHTML; | |
} | |
function exportDefinitions(_, content) { | |
const dfnsToExport = ["accessible name", "accessible description"]; | |
const temp = document.createElement("temp"); | |
temp.innerHTML = content; | |
const dfns = [ | |
...temp.querySelectorAll("dfn:not([data-export])"), | |
].filter(({ textContent: text }) => | |
dfnsToExport.includes(text.toLowerCase().trim()) | |
); | |
dfns.forEach(dfn => (dfn.dataset.export = "")); | |
return temp.innerHTML; | |
} |
I think this might be ok for a transitional step. |
@@ -3,11 +3,8 @@ | |||
<head> | |||
<title>Accessible Name and Description Computation 1.2</title> | |||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> | |||
<script src="https://www.w3.org/Tools/respec/respec-w3c-common" class="remove" defer></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably shouldn't touch any of these.
preProcess: [ linkCrossReferences ] | ||
} | ||
</script> | ||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<script> | |
<script class="remove"> |
Defintions have now been moved to their source specs. Most are defined in "wai-aria" and a few in "core-aam" I think this can be closed. |
Thanks for the update @jnurthen! |
Related to #84, I had an idea that would not require a wholesale overhaul of the definition export. Curious for your thoughts @marcoscaceres @jnurthen
This commit:
definitions_to_export
oninclude
hook and adds thedata-export
param to the existingdfn
elements that match the values in that array.💥 Error: 500 Internal Server Error 💥
PR Preview failed to build. (Last tried on Aug 25, 2020, 8:06 PM UTC).
More
PR Preview relies on a number of web services to run. There seems to be an issue with the following one:
🚨 Spec Generator - Spec Generator is the web service used to build specs that rely on ReSpec.
🔗 Related URL
If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.