Skip to content
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

Fix automatic exporting and add missing IDs back to mapping tables #105

Closed
wants to merge 3 commits into from

Conversation

spectranaut
Copy link
Contributor

@spectranaut spectranaut commented Jan 19, 2022

This is regard to: #102

Questions:

  • Do we want the "saved"/"exported" spec to use the summary details instead of the table? If so, automatic exporting of the spec will work now, with the summary details version of the tables. You can see this in the preview link below.
  • I couldn't test whether this solves the gh-pages bug (where the IDs are missing currently here: https://w3c.github.io/core-aam/), because I could never replicate that bug locally. But @jnurthen thinks this might fix it :) If anyone had ideas about how to replicate that scenario (besides running respec from the CLI, like it looks like it does in the github action) I'd like to hear about it!
  • I also removed the dependencies on respec events as in the issue it was discussed repub no longer publishes events. It turns out that the "mappingTables" function is called during respect "preprocessing" (as was configured in the preProcess parameter in the respecConfig), so once i removed the respec events code -- which was causing an error -- the tables showed up twice (as mappingTables was run twice, once during preprocessing and once when mapping-tables.js was loaded).

💥 Error: 500 Internal Server Error 💥

PR Preview failed to build. (Last tried on Feb 15, 2022, 11:22 AM 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

📡 HTTP Error 429: https://rawcdn.githack.com/w3c/core-aam/f723f1f3fcc451d9bed02d85e752347291ade8be/index.html

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.

@@ -103,16 +89,13 @@ function mappingTables() {

// create a container div to hold all the details element and insert after table
tableInfo.detailsContainer = document.createElement('div');
tableInfo.detailsContainer.className = 'details removeOnSave';
tableInfo.detailsContainer.className = 'details';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change makes it such that if you load the html page, click the "respec" menu button, then "export", the exported document has the "summary view" instead of the tables. Is this what we want?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure but I think we need the tables exported, because the UI script keys of those for the swap. But if saving the summary view still preserves two-way transformation ability, and we think it's a better default presentation, then I'd say that can work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I don't quite follow what your saying here @michael-n-cooper -- what is "the UI script keys of those for the swap"?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I mean my understanding is the table structure is used to build two representations, one a copy of the table structure, and the other the details structure. When a user switches view, the appropriate version is written to the DOM. My understanding from my last code review is that the initial setup depends on the table structure to be present, and therefore that's what we need to export in static snapshots.

However, if that's no longer the case, and we can have a working switcher in a static snapshot that contains the details version instead of the table version, then I think it meets requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you are talking about now -- the summary view is made from the table view, the table view is what you can see in the index.html file. The summary view is made when the page is loaded, and then the button to switch between the two just hides one and removes "ids", then shows the other and adds "ids". But the summary view is shown by default, so if you export the spec automatically it will export the summary view (the default) and everything will be fine. Though, the table will be in the html with display: none, if that matters.

Copy link
Member

Choose a reason for hiding this comment

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

I see. In that instance it's probably ok, assuming the display:none does its job. :)

@spectranaut
Copy link
Contributor Author

who else can review this, @jnurthen ?

@spectranaut
Copy link
Contributor Author

I just am realizing... should this PR (after approval I guess?) be moved to https://github.com/w3c/aria-common/blob/main/script/mapping-tables.js ?

And does anyone else use this file besides core-aam and html-aam?

@scottaohara
Copy link
Member

i would imagine any aam (present or future) should be able to use this, if i'm not mistaken?

@jnurthen
Copy link
Member

@jnurthen
Copy link
Member

And yes - this PR should be against aria-common but lets review it here first as its kind of hard to develop over there!

@spectranaut
Copy link
Contributor Author

@schne324 can you take a look at this pr? :)


var detailsHTML = '<summary id="' + id + '">' + summary;
var detailsHTML = '<summary id="' + id + '" data-id="' + id + '">' + summary;

Choose a reason for hiding this comment

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

adding an id and a data-id with identical values seems strange. What is the reasoning here? Maybe we should add a comment here in the code so the next person touching this code knows what is going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need them both at the same time! I just added a commit to make it so only one or the other exists. When converting between the "table view" and "summary view", the hidden view now has only the data-id attribute and the visible view has only an id attribute.

Does the make it less confusing?

@spectranaut
Copy link
Contributor Author

Can I have some reviews of this? :)

@spectranaut
Copy link
Contributor Author

Oh nice fix @michael-n-cooper I hadn't even noticed that was also broken. I opened a PR with these changes on aria-commons: w3c/aria-common#80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants