-
-
Notifications
You must be signed in to change notification settings - Fork 601
XWIKI-23602: Error boxes expand, but the markup does not convey this information to AT users #4670
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -308,24 +308,6 @@ Object.extend(XWiki, { | |
| } | ||
| }, | ||
|
|
||
| /** | ||
| * Add click listeners on all rendereing error messages to let the user read the detailed error description. | ||
| * If a content is passed, add click listener for errors reported in this content (usefull for AJAX requests response) | ||
| * Otherwise make all the document's body errors expandable. | ||
| */ | ||
| makeRenderingErrorsExpandable: function(content) { | ||
| $(content || 'body').select(".xwikirenderingerror").each(function(error) { | ||
| var description = error.next(".xwikirenderingerrordescription"); | ||
| if(description.innerHTML !== "" && description.hasClassName("xwikirenderingerrordescription")) { | ||
| error.style.cursor="pointer"; | ||
| error.title = "$escapetool.javascript($services.localization.render('platform.core.rendering.error.readTechnicalInformation'))"; | ||
| Event.observe(error, "click", function(event){ | ||
| event.element().closest(".xwikirenderingerror").next(".xwikirenderingerrordescription").toggleClassName("hidden"); | ||
| }); | ||
| } | ||
| }); | ||
| }, | ||
|
|
||
| /** | ||
| * Make links marked with rel="external" in an external window and sets the target attribute to any | ||
| * rel attribute starting with "_". Note that We need to do this in Javascript | ||
|
|
@@ -551,7 +533,6 @@ Object.extend(XWiki, { | |
| _addBehaviour: function(container) { | ||
| container = container || $('body'); | ||
|
|
||
| this.makeRenderingErrorsExpandable(container); | ||
| this.fixLinksTargetAttribute(container); | ||
| this.insertSectionEditLinks(container); | ||
| this.registerPanelToggle(container); | ||
|
|
@@ -1849,6 +1830,7 @@ require(['jquery', 'xwiki-meta', 'bootstrap'], ($, xm) => { | |
| if (XWiki.docsyntax !== "xwiki/1.0" && XWiki.contextaction === "view" && XWiki.hasEdit) { | ||
| $(rootElement).find('span.wikicreatelink:not(.skipCreatePagePopup) a').on('click', loadCreateModal); | ||
| } | ||
| makeRenderingErrorsExpandable(rootElement); | ||
| } | ||
|
|
||
| function loadCreateModal(event) { | ||
|
|
@@ -1881,6 +1863,34 @@ require(['jquery', 'xwiki-meta', 'bootstrap'], ($, xm) => { | |
| }) | ||
| } | ||
|
|
||
| /** | ||
| * Add click listeners on all rendering error messages to let the user read the detailed error description. | ||
| * If a content is passed, add click listener for errors reported in this content (useful for AJAX requests response) | ||
| * Otherwise make all the document's body errors expandable. | ||
| */ | ||
| function makeRenderingErrorsExpandable(content) { | ||
| $(content || 'body').find('.xwikirenderingerror').each(function (index) { | ||
| let error = $(this); | ||
| let description = error.next(".xwikirenderingerrordescription"); | ||
| if (description.innerHTML !== "" && description.hasClass("xwikirenderingerrordescription")) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this if: first |
||
| error.attr('id', 'xwikirenderingerror-' + index); | ||
| error.attr('role', 'button'); | ||
| description.attr('id', 'xwikirenderingerrordescription-' + index); | ||
| error.attr('aria-controls', 'xwikirenderingerrordescription-' + index); | ||
| error.attr('aria-expanded', false); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that you can use an object in attr, that would make the code maybe a bit more readable: |
||
| let buttonDescription = "$escapetool.javascript($services.localization.render('platform.core.rendering.error.readTechnicalInformation'))" | ||
| error.attr('title', buttonDescription); | ||
| error.on("click", function () { | ||
| // Toggle both the description class and the aria-expanded attribute of the button. | ||
| let error = $(this); | ||
| let description = error.next('.xwikirenderingerrordescription'); | ||
| description.toggleClass("hidden"); | ||
| error.attr('aria-expanded', error.attr('aria-expanded') === 'true' ? 'false' : 'true') | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| $(document).on('xwiki:dom:updated', (event, data) => { | ||
| const containers = data?.elements || [document.documentElement]; | ||
| containers.forEach(init); | ||
|
|
||
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.
Isn't this removing a public JavaScript API? While I can't find any usages, I'm not sure if it's okay to just remove it. I think this would need a vote on the forum to break this API.